【问题标题】:LDAP authentication using jboss security domain使用 jboss 安全域的 LDAP 身份验证
【发布时间】:2015-12-26 10:18:36
【问题描述】:

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

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

这是我们目前拥有的:

/WEB-INF/jboss-web.xml: jboss-web 安全域 java:/jaas/ad-ldap 安全域 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}");
}
}

谢谢

【问题讨论】:

  • 你真的能够完成这项工作吗?如果可以,请您回复回复。

标签: authentication spring-security jboss ldap securitydomain


【解决方案1】:

您只需要在独立 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

【讨论】:

  • 感谢您的反馈。我仍然无法完成这项工作。我们正在使用 Java 配置,因此我们没有 web.xml 文件。我在 /WEB-INF 下有一个 jboss-web.xml,其安全域定义为:java:/jaas/ad-ldap。 Spring 不加载它,而是加载 Spring 附带的默认 LDAP 服务器。我在最初的帖子中添加了一些额外的信息。任何进一步的帮助将不胜感激。
  • 试试:ad-ldap
猜你喜欢
  • 1970-01-01
  • 2011-05-04
  • 2013-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-13
  • 1970-01-01
相关资源
最近更新 更多