【发布时间】: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