Custom LdapAuthoritiesPopulator – Spring Security

1. Introduction

In this article, we will be dealing with the scenario where we will be configuring the user authorities with our own custom implementation rather than the more traditional way to fetch the same from LDAP. There might actually be several reasons to do this, the application’s performance being one of the several reasons.

2. Implementation

To implement our own authorities populator, let’s create the custom implementation class.

CustomLdapAuthoritiesPopulator.java

Add the bean entry for the same to Spring context.


spring-security.xml

3. Running the application

The application can be executed and tested the same way as we have done earlier for the below article –

Spring Security LDAP Authentication

4. Download the source code

 

Receive our updates to your inbox

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.