2016-08-17 85 views
1

我正在使用以下配置成功獲取LDAP屬性值,並且我可以在日誌文件中看到這些值。CAS 4.2獲取LDAP屬性

<bean id="ldapAuthenticationHandler" 
     class="org.jasig.cas.authentication.LdapAuthenticationHandler" 
       p:principalIdAttribute="sAMAccountName" 
       c:authenticator-ref="authenticator"> 
      <property name="principalAttributeMap"> 
       <map> 
        <entry key="displayName" value="simpleName" /> 
        <entry key="mail" value="email" /> 
        <entry key="memberOf" value="membership" /> 
       </map> 
      </property> 
    </bean> 

現在我該如何發送這些屬性到客戶端?

這是我deployerConfigContext.xml裏默認attributeRepository:

<bean id="attributeRepository" class="org.jasig.services.persondir.support.NamedStubPersonAttributeDao" 
      p:backingMap-ref="attrRepoBackingMap" /> 

<util:map id="attrRepoBackingMap"> 
    <entry key="uid" value="uid" /> 
    <entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> 
    <entry key="groupMembership" value="groupMembership" /> 
    <entry> 
     <key><value>memberOf</value></key> 
     <list> 
      <value>faculty</value> 
      <value>staff</value> 
      <value>org</value> 
     </list> 
    </entry> 
</util:map> 

有沒有一種方法來填充attributeRepository與principalAttributeMap?

當我從deployerConfigContext.xml中刪除attributeRepository時發生異常。

根據此文檔https://apereo.github.io/cas/4.2.x/installation/LDAP-Authentication.html,LdapAuthenticationHandler能夠獨立解析和檢索主體屬性,而無需額外的主分解器機制。如果是這樣,我們如何才能將這些屬性返回給客戶?

回答

0

按照本文檔https://apereo.github.io/cas/4.2.x/installation/LDAP-Authentication.html

如果你決定讓認證處理程序檢索屬性,而不是一個單獨的主變壓器,您需要確保鏈接的解析器是由非活動:

<util:map id="authenticationHandlersResolvers"> 
    ... 
    <entry key-ref="ldapAuthenticationHandler" value="#{null}" /> 
</util:map> 

進行此更改後,它開始工作。