*I want to run CAS with JDBC backend. I've succeeded to use simple
authentication (login and password). The problem is that I need to add
another attribute (such as group), so that it will be returned in the
XML success response.*

*Here is the *deployerConfigContext.xml* (only important parts):*

...
...
<bean 
class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver"
>
<property name="attributeRepository">
        <ref bean="attributeRepository"/>
</property>
</bean>

<bean 
class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler"
>
  <property name="dataSource" ref="dataSource"/>
  <property name="passwordEncoder" ref="passwordEncoder"/>
  <property name="fieldUser" value="login"/>
  <property name="fieldPassword" value="password"/>
  <property name="tableUsers" value="user"/>
</bean>

</list>
</bean>
...
...

<bean id="attributeRepository"
class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
        <constructor-arg index="0" ref="dataSource"/>
        <constructor-arg index="1">
                <list>
                        <value>login</value>
                </list>
        </constructor-arg>
        <constructor-arg index="2" value="SELECT group FROM user WHERE 
login='?'"/>
        <property name="columnsToAttributes">
                <map>
                        <entry key="group" value="group" />
                </map>
        </property>
</bean>
...
...
<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="com.mysql.jdbc.Driver"
    p:url="jdbc:mysql://localhost:3306/CAS"
    p:username="cas"
    p:password="password" />


*I've also modified the *casServiceValidationSuccess.jsp* to handle
the new attribute:*

<c:forEach var="auth" items="${assertion.chainedAuthentications}">
        <c:forEach var="attr" items="${auth.principal.attributes}">
                <cas:attribute name="${fn:escapeXml(attr.key)}"
value="${fn:escapeXml(attr.value)}"/>
        </c:forEach>
</c:forEach>


*The problem is that when I enter a valid user credentials, I get this
exception:*

action execution attributes were 'map['method' -> 'submit']'; nested
exception is java.lang.NullPointerException

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to