Step-by-Step Guide to Implementing LDAP Authentication in Spring Boot

Samuel Addico
CodeOps
Published in
3 min readMay 4, 2018

--

Introduction

In this tutorial am going to walk you through how to configure LDAP authentication in Spring Boot. LDAP is used as a central repository for user information. Applications then connect to this repository for user searches and authentication. Spring Boot offers auto-configuration for any compliant LDAP server as well as support for the embedded in-memory LDAP server. This tutorial assumes you are already familiar with the Spring Boot.

Dependencies

Below is the pom.xml file detailing the dependencies used in the illustration.

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-ldap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>…

--

--

Samuel Addico
CodeOps

DevOps | SRE | Java | Kubernetes | AWS | Ansible | Terraform | CI/CD