我現在有我的LDAP身份驗證的情況下建立這樣的:春季安全定製LDAP身份驗證提供
<ldap-server url="ldap://host/dn"
manager-dn="cn=someuser"
manager-password="somepass" />
<authentication-manager>
<ldap-authentication-provider user-search-filter="(samaccountname={0})"/>
</authentication-manager>
現在,我需要能夠建立一個自定義當局映射器(它使用不同的LDAP服務器) - 所以我假設我需要設置我的LDAP服務器類似(http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ldap.html):
<bean id="ldapAuthProvider"
class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
<constructor-arg>
<bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
<constructor-arg ref="contextSource"/>
<property name="userDnPatterns">
<list><value>uid={0},ou=people</value></list>
</property>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
<constructor-arg ref="contextSource"/>
<constructor-arg value="ou=groups"/>
<property name="groupRoleAttribute" value="ou"/>
</bean>
</constructor-arg>
</bean>
但是,我怎麼引用「ldapAuthProvider」在安全方面的LDAP服務器?
我也使用彈簧安全3,所以「」不存在...
當我看到您的標題問題並閱讀下面的信息時,我感到非常困惑。對於我**身份驗證**連接到用戶名和密碼,而據我所知,它的實際問題是**授權**。由於下面的答案已經提到了定製populator,例如[自定義populator的詳細描述](http://stackoverflow.com/questions/34658534/spring-security-switch-to-ldap-authentication-and-database-authorities) 。你可以改變文本到權威populator嗎? :) – Dr4gon 2017-02-12 12:53:19