CAS 4.2 获取 LDAP 属性

CAS 4.2 get LDAP attributes

我正在使用以下配置成功获取 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>

现在如何将这些属性发送给客户端?

这是我的默认 attributeRepository deployerConfigContext.xml:

<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>

有没有办法用 principalAttributeMap 填充 attributeRepository?

当我从 deployerConfigContext.xml 中删除 attributeRepository 时抛出异常。

根据此文档 https://apereo.github.io/cas/4.2.x/installation/LDAP-Authentication.html,LdapAuthenticationHandler 能够独立解析和检索主体属性,而无需额外的主体解析器机制。如果是这样,我们如何 return 将这些属性提供给客户?

根据此文档 https://apereo.github.io/cas/4.2.x/installation/LDAP-Authentication.html

如果您决定让身份验证处理程序检索属性而不是单独的主体解析器,则需要确保链接的解析器处于非活动状态:

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

进行此更改后,它开始工作了。