【问题标题】:Dynamically Configure LDAP Server using Spring Security使用 Spring Security 动态配置 LDAP 服务器
【发布时间】:2016-08-29 04:53:51
【问题描述】:

Spring Security Tutorial 有一个配置 LDAP 服务器的示例:

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .anyRequest().fullyAuthenticated()
                .and()
            .formLogin();
    }
    @Configuration
    protected static class AuthenticationConfiguration extends
            GlobalAuthenticationConfigurerAdapter {

        @Override
        public void init(AuthenticationManagerBuilder auth) throws Exception {
            auth
                .ldapAuthentication()
                .userDnPatterns("uid={0},ou=people")
                .groupSearchBase("ou=groups")
                .contextSource().ldif("classpath:test-server.ldif");
        }
    }
}

但是,我正在寻找一种方法来动态初始化 LDAP 服务器,而不是在配置文件中。我似乎找不到任何例子。这样做的目的是为登录表单实现 SSO。

【问题讨论】:

  • 这里没有配置 LDAP 服务器的内容。正在配置的是 Spring,它被告知如何使用现有且已配置的 LDAP 服务器。
  • 对不起 - 我的意思是动态配置 spring 以连接到预先配置的 LDAP 服务器

标签: java spring spring-security ldap spring-ldap


【解决方案1】:

我发现使用较低级别的目录ldaptive 来解决这个问题更容易。

【讨论】:

    猜你喜欢
    • 2012-07-19
    • 1970-01-01
    • 1970-01-01
    • 2017-02-13
    • 2014-12-30
    • 1970-01-01
    • 2020-02-14
    • 1970-01-01
    • 2020-07-18
    相关资源
    最近更新 更多