Managing LDAP users with Spring Data

One part of our integration is over. The LDAP admin can configure users from the LDAP server; then, they can be authenticated from web applications created with Spring Security. However, we still have to deal with separate systems (Apache DS) to maintain the user information.

How cool would it be if an admin could directly maintain the users from a Spring web application? This is a great idea, because it will not only make the admin job easy, but a user will be able to update their profile information (like the password, first name, last name, and so on) directly in the Spring-based web application. This is quite possible with Spring Boot. We are talking about performing CRUD operations on the LDAP server from a web application. 

In our application, the LDAP is used as a data store, where we are maintaining user data. Whenever we need to deal with any kind of data provider in a Spring-based application, we need to use Spring Data, a module of the Spring family that was specially designed to interact with the data store. Spring Data facilitates an abstract layer to interact with the underlying data provider, while providing an implementation for each of the data providers, like JPA, REST, Elasticsearch (which we used in the previous chapter), Mongo DB, and so on. Spring Data LDAP interacts with the LDAP server, and we will use it in our application.

Spring supplies a set of libraries for each of these data providers, which can be availed of by specifying the corresponding starter in the Spring Boot application. The Spring Data LDAP module can be integrated with the following starter entry in pom.xml:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-ldap</artifactId>
</dependency>

Soon after we have defined this starter, all of the required JARs will be available in the classpath. Next, we will create the model (entity) class.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.44.223