In this blog post we are going to connect a sample spring boot application with LDAP based userstore to do the authentication.
First create a LDAP server. I've created a sample server using Apache Directory Studio.
Then in your sample application extend the WebSecurityConfigurerAdapter class and override the below two methods. Provide the connection details as per the ldap server created above.
That's it the spring will engage basic authenticate your requests to the webapp.
Now start the app using mvn spring-boot:run or using the java -jar spring-boot-ldap-sample.jar, Access the webapp using http://localhost:8080/ and provide the credentials of a user in the ldap user base. You'll see the authenticated user's details after a successful authentication.
Full source to the sample can be found here.