【发布时间】:2019-05-09 21:08:46
【问题描述】:
所以这是我第一次使用 Spring,所以请多多包涵!
我很确定问题在于我对 DnPatterns 和组搜索库的设置不正确。
我正在尝试连接一个外部广告。使用广告资源管理器我找到了一个条目,下面是用户的 dn,然后是他们通常用来登录的登录 id
在 AD Explorer 视图中的用户配置文件中收听
DN -> CN=LastName\, FirstName, OU=Users,OU=Calgary,DC=CORP,DC=DEPARTMENT,DC=com
用户名和密码用户将在登录时提供:
UserName -> LastFirst5
Password -> Password
在目录浏览器中到达用户信息的路径如图所示
DC=CORP,DC=DEPARTMENT,DC=com -> OU=Calgary -> OU=Users -> CN=LastName,FirstName
这是我的配置设置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and()
.formLogin();
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("DC=corp,DC=department,DC=com")
.groupSearchBase("OU=Users,OU=Calgary,DC=CORP,DC=Department,DC=com")
.contextSource()
.url("ldap://corp.Ad.com/")
.and()
.passwordCompare()
.passwordEncoder(new LdapShaPasswordEncoder())
.passwordAttribute("userPassword");
}
【问题讨论】:
标签: java spring-boot authentication ldap