Click here to Skip to main content
15,559,491 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I would like to implement LDAP authentication for a web application using Spring Boot.

Here is my WebSecurityConfig class:
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    protected void configure(HttpSecurity http) throws Exception {

    protected static class AuthenticationConfiguration extends
            GlobalAuthenticationConfigurerAdapter {

        public void init(AuthenticationManagerBuilder auth) throws Exception {

I tested it with my institutional credentials with the following DN:

On login page, if I type in djiao as my username and a wrong password, it will say "bad credentials". However if I give the correct password, I would get 500:
There was an unexpected error (type=Internal Server Error, status=500).
Uncategorized exception occured during LDAP processing; nested exception is javax.naming.NamingException: [LDAP: error code 1 - 000004DC: LdapErr: DSID-0C0906E8, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db1]; remaining name ''

It seems binding to ldap server is successful otherwise it would not have distinguished correct password from bad password. But why am I getting this error?

What I have tried:

I tried to login with a bad password and got "login not successful, reason: bad credentials". With the correct password, it got to a Whitelabel Error Page with the aforementioned error.
Shubhashish_Mandal 28-Apr-16 6:08am    
You have to perform bind operation .This could help you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900