I want to use spring security ldap authentication. However I would like to traverse ldap tree recursively. Unfortunately I can find a user only one level or depth.
For example , my user tree likes below:
ouUsers: has users (user1, user2 etc) and subtrees (ouGenel, ouYatay).
And subtrees have subtrees and users.
I would like to traverse the ldap tree recursively to authenticate in spring security project.
My spring authencation code is below, what should I change in my code? :
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("CN={0},OU=ouUsers")
.groupSearchBase("ou=ouUsers")
.contextSource()
.url(url+"/"+base)
.managerDn(dn)
.managerPassword(password)
.and()
.passwordCompare()
.passwordEncoder(new LdapShaPasswordEncoder())
.passwordAttribute("sn");
}
Thank you