nnd,今天搞了快2個小時,總是無法解決ldap支持的其他屬性返回問題,因為之前配置的是3.3.5版本,現(xiàn)在最新的版本是3.4.11,原來的配置竟然無法使用了,原來是因為增加服務(wù):
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
導(dǎo)致無法返回principal的其他屬性到客戶端,其實象這樣配置即可:
<bean id="attributeRepository"
class="org.jasig.services.persondir.support.ldap.LdapPersonAttributeDao">
<property name="contextSource" ref="contextSource" />
<property name="baseDN" value="ou=users,${ldap.basePath}" />
<property name="requireAllQueryAttributes" value="true" />
<!--
Attribute mapping beetween principal (key) and LDAP (value) names
used to perform the LDAP search. By default, multiple search criteria
are ANDed together. Set the queryType property to change to OR.
-->
<property name="queryAttributeMapping">
<map>
<entry key="username" value="uid" />
</map>
</property>
<property name="resultAttributeMapping">
<map>
<!-- Mapping beetween LDAP entry attributes (key) and Principal's (value) -->
<entry key="name" value="userName"/>
<entry key="uid" value="userId"/>
</map>
</property>
</bean>
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
<property name="registeredServices">
<list>
<bean class="org.jasig.cas.services.RegisteredServiceImpl">
<property name="id" value="0" />
<property name="name" value="HTTP" />
<property name="description" value="Only Allows HTTP Urls" />
<property name="serviceId" value="http://**" />
<property name="evaluationOrder" value="10000001" />
<property name="ignoreAttributes" value="true" />
</bean>
………………
</list>
</property>
</bean>
如上所示,其中注冊的服務(wù)
registeredServices
默認是不允許返回其他屬性到客戶端的!!!!!,真的是很坑爹啊,不過,配置一下ignoreAttributes即可,也可以指定
allowedAttributes如下:
<property name="allowedAttributes">
<list>
<value><!-- your attribute key --></value>
</list>
</property>