Authentication 使用jboss安全域的LDAP身份验证

Authentication 使用jboss安全域的LDAP身份验证,authentication,spring-security,jboss,ldap,securitydomain,Authentication,Spring Security,Jboss,Ldap,Securitydomain,在使用spring 4.1.6、spring security 4.0.1和JavaConfig的JBOSS EAP 6上运行的web应用程序中,我们尝试实现LDAP身份验证,但不是在配置(AuthenticationManagerBuilder auth)中定义LDAP服务器的属性(url等)方法我们希望从容器上已经配置的JBOSS安全域中获取属性,该域具有所有需要的属性 我们尝试了几件事,并在网上搜索实现这一点的方法,但未能找到解决方案 这就是我们目前拥有的: /WEB-INF/jboss-

在使用spring 4.1.6、spring security 4.0.1和JavaConfig的JBOSS EAP 6上运行的web应用程序中,我们尝试实现LDAP身份验证,但不是在配置(AuthenticationManagerBuilder auth)中定义LDAP服务器的属性(url等)方法我们希望从容器上已经配置的JBOSS安全域中获取属性,该域具有所有需要的属性

我们尝试了几件事,并在网上搜索实现这一点的方法,但未能找到解决方案

这就是我们目前拥有的:

/WEB-INF/jboss-WEB.xml: JBossWeb 安全域 java:/jaas/ad ldap 安全域 JBossWeb

安全配置类:

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

谢谢

您只需要在独立XML中的安全域中定义LDAP服务器URL

但请注意,在上面的示例中,web.xml中的Realm name元素应该是:

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

感谢您的反馈。我还是没办法做到这一点。我们使用Java配置,因此没有web.xml文件。我在/web-INF下有一个jboss-web.xml,其安全域定义为:java:/jaas/ad ldap。Spring不加载这个,而是加载Spring附带的默认LDAP服务器。我在最初的帖子中添加了一些额外的信息。任何进一步的帮助都将不胜感激。尝试:ad ldap你真的能做到这一点吗?如果是的话,请帮我把答案寄回来。