私はCAS4.0を使用してLDAPサーバーに接続します。模擬データを使ってテストすると、LDAPサーバーからuid/passwordを認証し、StubPersonAttributeDao
からデータを取得できます。次に、LDAPサーバーからデータを修正し、認証に失敗し、エラーPersonDirectoryPrincipalResolver failed to resolve principal
を取得します。誰でも助けることができますか?詳しいストーリーは以下の通りです:CAS 4 - LDAP属性を取得してエラー 'PersonDirectoryPrincipalResolverがプリンシパルを解決できませんでした。
は、私は次のように模擬データを使用するdeployerConfigContext.xml
でattributeRepository
を追加します。serviceValidateを呼び出すとき
<bean id="attributeRepository" class="org.jasig.services.persondir.support.StubPersonAttributeDao"
p:backingMap-ref="attrRepoBackingMap" />
<util:map id="attrRepoBackingMap">
<entry key="uid" value="uid" />
<entry key="eduPersonAffiliation" value="eduPersonAffiliation" />
<entry key="groupMembership" value="groupMembership" />
</util:map>
コードを実行している、私は成功したモック属性eduPersonAffiliationとgroupMembershipを取得することができます。
その後、私はCASにLDAPサーバーからデータを取得しようとするので、私は、次のようattributeRepository
を変更:
<bean id="attributeRepository"
class="org.jasig.cas.persondir.LdapPersonAttributeDao"
p:baseDN="dc=example,dc=com"
p:searchFilter="uid={0}"
p:searchControls-ref="searchControls"
p:connectionFactory-ref="connectionFactory"
p:resultAttributeMapping-ref="resultAttributeMap"
/>
<util:map id="resultAttributeMap">
<entry key="uid" value="uid" />
<entry key="mail" value="mail" />
<entry key="cn" value="cn" />
</util:map>
<bean id="searchControls"
class="javax.naming.directory.SearchControls"
p:searchScope="2"
/>
私は、次のようldapAuthenticationHandler
があります
<bean id="ldapAuthenticationHandler"
class="org.jasig.cas.authentication.LdapAuthenticationHandler"
p:principalIdAttribute="uid"
c:authenticator-ref="authenticator">
<property name="principalAttributeMap">
<map>
<entry key="uid" value="uid" />
<entry key="mail" value="mail" />
<entry key="cn" value="cn" />
</map>
</property>
</bean>
けど、エラー、次のよう最初に正常に認証された後、認証に失敗するエラーが発生しました。 2016-05-18 15:02:44,979 INFO
[org.jasig.cas.authentication.PolicyBasedAuthenticationManager] - LdapAuthenticationHandler successfully authenticated newton+password
2016-05-18 15:02:44,985 ERROR [org.jasig.cas.authentication.PolicyBasedAuthenticationManager] - org.jasi[email protected]35ab1a4c failed to resolve principal from newton+password
java.lang.IllegalStateException: Connection is not open
at org.ldaptive.DefaultConnectionFactory$DefaultConnection.getProviderConnection(DefaultConnectionFactory.java:272)
誰かがそれを修正する方法を知っていますか?
解決しましたか?私はこれで苦労している。私はattributeRepositoryを持っていないので、エラーは発生しません。私は何のエラーもなく、ただ属性が戻ってきていません。 Apereoのドキュメントはおそらく何かを見逃しているようです。 –