Java 如何通过不同的入口键通过CAS获取数据源属性
我以前问过那个问题,但没有回答。我想我的问题不清楚,所以我会再试一次: 我正在使用CAS对ldap进行身份验证: 我还将从数据库中获取属性:Java 如何通过不同的入口键通过CAS获取数据源属性,java,authentication,cas,Java,Authentication,Cas,我以前问过那个问题,但没有回答。我想我的问题不清楚,所以我会再试一次: 我正在使用CAS对ldap进行身份验证: 我还将从数据库中获取属性: <property> <list> <bean class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver"/> <bean class="org.jasig.cas.a
<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>
现在,从数据库中选择属性的输入键由从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"/>
//在这里,我想使用不同于用户名的输入键。怎样?
在我的例子中,我希望通过不同的条目键(从LDAP检索)从数据库中选择属性
例如:
假设我在ldap中有此记录:
用户名:约翰
电邮:john@john.com
现在,在进行身份验证后,我希望通过以下方式从数据库中选择属性:
选择*from USERS_ATTRS,其中email={0}
- {0}是从LDAP检索的电子邮件属性李>