I asked this question before, but did not answer. I think my question is not clear, so I will try again:
I use CAS for authentication using ldap:
I also take attributes from the database:
<property>
<list>
<bean class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver"/>
<bean class="org.jasig.cas.authentication.principal.CredentialsToLDAPAttributePrincipalResolver">
<property name="credentialsToPrincipalResolver">
<bean class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver"/>
</property>
<property name="filter" value="(uid=%u)"/>
<property name="principalAttributeName" value="uid"/>
<property name="searchBase" value="ou=Users,dc=openiam,dc=com"/>
<property name="contextSource" ref="contextSource"/>
<property name="attributeRepository" ref="attributeRepository"/>
</bean>
</list>
</property>
Now the login key for selecting attributes from the database is the username that was obtained from LDAP:
<bean class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
<constructor-arg index="0" ref="dataSource1"/>
<constructor-arg index="1" value="SELECT * FROM USER_DATA WHERE {0}"/>
<property name="queryAttributeMapping">
<map>
<entry key="username" value="LOGINNAME"/>
//here I would like to use diffrenty entry key than username. how?
</map>
</property>
<property name="resultAttributeMapping">
<map>
<entry key="ROLE_NAME" value="ROLE_NAME"/>
<entry key="PERMISSIONS" value="PERMISSIONS"/>
<entry key="APP_NAME" value="APP_NAME"/>
</map>
</property>
</bean>
<entry key="username" value="uid"/>
In my case, I would like to select attributes from the database using a different input key (which was obtained from LDAP).
For example:
let's say I have this entry in ldap:
username: john
email: john@john.com
Now, after authentication, I want to select the following attributes from the database: select * from USERS_ATTRS, where email = {0}
- {0} is the email attribute that was received from LDAP.
thanks.