0

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}");
}
}

ありがとう

4

1 に答える 1

0

スタンドアロン XML のセキュリティ ドメインで LDAP サーバー URL を定義するだけで済みます。

http://www.mastertheboss.com/jboss-server/jboss-security/configure-jboss-with-ldap?start=1 ただし、上記の例では、web.xml のレルム名要素は次のようにする必要があることに注意してください。

<realm-name>LDAPAuth</realm-name>

https://docs.jboss.org/author/display/WFLY8/Examples

于 2015-10-01T08:08:33.983 に答える