Active Directory 認証に Spring Security 3.1 を使用し、権限をロードするためにローカル データベースを使用しています。同様の例を見たことがありますが、正確に何を使用すればよいかはまだ明確ではありません。spring-security.xml の現在の設定は次のとおりです。
<!-- LDAP server details -->
<security:authentication-manager>
<security:authentication-provider ref="ldapActiveDirectoryAuthProvider" />
</security:authentication-manager>
<beans:bean id="ldapActiveDirectoryAuthProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
<beans:constructor-arg value="${ldap.domain}" />
<beans:constructor-arg value="${ldap.url}" />
<beans:property name="useAuthenticationRequestCredentials" value="true" />
<beans:property name="convertSubErrorCodesToExceptions" value="true" />
</beans:bean>
「BookStoreDbAuthPopulator.java」という名前のクラスがあります。このクラス内で、次のメソッドを呼び出しています。
// Load additional authorities and create an Authentication object
final List<GrantedAuthority> authorities = loadRolesFromDatabaseHere();
私にとってまだ明確でないこと:ロードされた権限をdbからUserDetailsに追加するために、「BookStoreDbAuthPopulator.java」はどのインターフェースを実装する必要がありますか? 「UserDetailsContextMapper」または「GrantedAuthoritiesMapper」または「AuthenticationProvider」?
このソリューションに基づいて: Spring Security 3 Active Directory 認証、データベース認証 "BookStoreDbAuthPopulator.java" は "AuthenticationProvider" を実装する必要があります。「BookStoreDbAuthPopulator.java」を「ldapActiveDirectoryAuthProvider」Bean のプロパティとして使用する必要があるかどうかは疑問です。
よろしくお願いします。