spring 4.1.6、spring security 4.0.1、および JavaConfig を使用する JBOSS EAP 6 で実行されている Web アプリケーションでは、LDAP 認証を実装しようとしていますが、configure で LDAP サーバーのプロパティ (url など) を定義する代わりに(AuthenticationManagerBuilder auth) メソッドを使用して、コンテナーで既に構成されていて、必要なすべてのプロパティを備えている JBOSS セキュリティ ドメインからプロパティを取得したいと考えています。
私たちはいくつかのことを試し、これを達成するためのアプローチを Web で検索しましたが、解決策を見つけることができませんでした.
これは私たちが現在持っているものです:
/WEB-INF/jboss-web.xml: jboss-web security-domain java:/jaas/ad-ldap security-domain jboss-web
セキュリティ構成クラス:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().realmName("ad-ldap");
http.formLogin().loginPage("/login").loginProcessingUrl("/loginProcess");
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userSearchBase("OU=users,DC=local")
.userSearchFilter("(sAMAccountName={0})")
.groupSearchBase("OU=groups,DC=local")
.groupSearchFilter("sAMAccountName={0}");
}
}
ありがとう