Hello,
I have a strange problem retrieving attributes. When I restart the server,
the first time that I do log in, everything seems ok, and I obtain the
attribute (in this case mail) correctly. But this only happens in the first
attempt to login. The following attempts I can login but the attribute
"attributes" in the principal object is null.

My deployerConfigContext.xml:





<bean id="authenticationManager"
        class="org.jasig.cas.authentication.PymesAuthenticationManagerImpl">
        <property name="credentialsToPrincipalResolvers">
            <list>
                 <bean

class="org.jasig.cas.authentication.principal.PymesCredentialsToLDAPAttributePrincipalResolver">

                    <property name="credentialsToPrincipalResolver">
                        <bean

class="org.jasig.cas.authentication.principal.CompanyUsernamePasswordCredentialsToPrincipalResolver"
>
                        </bean>
                    </property>

                    <property name="filter" value="(cn=%u)" />

                    <property name="principalAttributeName" value="cn" />

                    <property name="searchBase"
                        value="ou=%e,o=empresas" />
                    <property name="contextSource" ref="contextSource" />

                     <property name="attributeRepository">
                        <ref bean="attributeRepository" />
                    </property>

                </bean>
            </list>
        </property>

        <property name="authenticationHandlers">
            <list>
            <bean
class="org.jasig.cas.authentication.principal.PymesFastBindLdapAuthenticationHandler">
                                 <property name="filter"
value="cn=%u,ou=usuarios,ou=%e,o=empresas" />
                                <property name="contextSource"
ref="contextSource" />

            </bean>
            </list>
        </property>
</bean>

    <bean id="contextSource"
class="org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource">
        <property name="anonymousReadOnly" value="false"/>
        <property name="password" value="xxx" />
        <property name="pooled" value="true" />
        <property name="urls">
            <list>
                   <value>ldap://xxx.xx.xx.x:10389</value>
            </list>
        </property>
        <property name="userName" value="uid=admin,ou=system" />

        <property name="baseEnvironmentProperties">
            <map>
                  <entry>

<key><value>java.naming.security.authentication</value></key>
                        <value>simple</value>
                    </entry>
                </map>
        </property>
    </bean>


    <bean id="userDetailsService"
class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
        <property name="userMap">
            <value>
              user4=notused,ROLE_ADMIN
            </value>
        </property>
    </bean>

     <bean id="attributeRepository"

class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao">
        <property name="baseDN" value="o=empresas" />
        <property name="query" value="(cn={0})" />
        <property name="contextSource" ref="contextSource" />
        <property name="ldapAttributesToPortalAttributes">
            <map>
                 <entry value="mail" key="mail" />
            </map>
        </property>

    </bean>
    <bean
        id="serviceRegistryDao"
        class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" >
        <property name="registeredServices">
        <list>
            <bean
                class="org.jasig.cas.services.RegisteredServiceImpl"
                p:id="1"
                p:description="Todo"
                p:serviceId="*://*localhost*/**"
                p:name="Todo"
                p:theme="Todo"
                p:allowedToProxy="true"
                p:enabled="true"
                p:ssoEnabled="true"
                p:anonymousAccess="false">

                <property name="allowedAttributes" value="mail"/>

            </bean>
        </list>
        </property>
    </bean>
</beans>





I've tried to addapt AbstractPersonDirectoryCredentialsToPrincipalResolver,
changing the attributeRepository type  from StubPersonAttributeDao() to
LdapPersonAttributeDao(), but I obtain a null pointer exception due to null
context.

If I don't change the type and work with StubPersonAttributeDao() , the
first time in
 final Map attributes =
this.attributeRepository.getUserAttributes(principalId);
everthing is ok, but the second time this returns attributes=null

Is my deployerConfigContext.xml ok?Should I customize any class?Any idea?

My cas server is 3.1.1

Thanks
_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to