Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

openldap - Spring security LDAP- Error LDAP: error code 50 - Insufficient Access Rights

I am trying to use LDAP authentication with spring sceurity. I followed the article https://spring.io/guides/gs/authenticating-ldap/ for implementation. I am getting error "[LDAP: error code 50 - Insufficient Access Rights]; nested exception is javax.naming.NoPermissionException: [LDAP: error code 50 - Insufficient Access Rights]; remaining name 'uid=pmerla,ou=people'". How can this issue be fixed? below is my code for configuration

@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {


@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests()
            .anyRequest().fullyAuthenticated()
            .and()
            .formLogin();
}

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth
            .ldapAuthentication()
            .userDnPatterns("uid={0},ou=people")
            .groupSearchBase("ou=groups")
            .contextSource()
            .url("ldaps://ldap.uchicago.edu/dc=uchicago,dc=edu")
            .and()
            .passwordCompare()
            .passwordEncoder(new BCryptPasswordEncoder())
            .passwordAttribute("userPassword");

}

}

I also tested if ldap connection is active from my terminal using below command ldapsearch -H ldaps://ldap.uchicago.edu -D "uid=pmerla,ou=people,dc=uchicago,dc=edu" -W and it is giving me correct response

# extended LDIF
#
# LDAPv3
# base <> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# search result
search: 2
result: 32 No such object
question from:https://stackoverflow.com/questions/65831391/spring-security-ldap-error-ldap-error-code-50-insufficient-access-rights

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...