Unable to call ldap in Spring boot application which is deployed in apachi tomacat server getting error

110 views Asked by At

@Configuration @EnableWebSecurity(debug = true) public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    //Getting values from properties file
    @Value("${ldap.urls}")
    private String ldapUrls;
    @Value("${ldap.base.dn}")
    private String ldapBaseDn;
    @Value("${ldap.username}")
    private String ldapSecurityPrincipal;
    @Value("${ldap.password}")
    private String ldapPrincipalPassword;
    @Value("${ldap.user.dn.pattern}")
    private String ldapUserDnPattern;
    @Value("${ldap.enabled}")
    private String ldapEnabled;

    @Override
    protected void configure(HttpSecurity http) throws Exception {

    http.httpBasic().disable().authorizeRequests().anyRequest().authenticated().and().csrf().disable()
    .formLogin();
    

    }
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {

    auth
    .ldapAuthentication()
    .contextSource()
    .url(ldapUrls + ldapBaseDn)
    .managerDn(ldapSecurityPrincipal)
    .managerPassword(ldapPrincipalPassword)
    .and()
    .userSearchBase("ou=People")
    .userSearchFilter("sAMAccountName={0}").
    //userDnPatterns("member={0}").
    groupSearchBase("ou=Groups");
    
    //.userDnPatterns(ldapUserDnPattern);
    }
}

using above code getting error [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090453, comment: AcceptSecurityContext error, data 52e, v3839]; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090453, comment: AcceptSecurityContext error, data 52e, v3839]

0

There are 0 answers