Search code examples
spring-bootactive-directoryldapopenldapspring-actuator

Springboot Authentication with 2 different Ldaps - How to show status of both Ldaps in Actuator /health


I was able to make my Springboot API authenticate against 2 different Ldaps (for example with AD and OpenLdap) and that is working fine.

In order for Spring Actuator to be able to report on status of my Ldaps, in my application.properties, I have setup ldap properties for username, password and urls like:

spring.ldap.username1=user1
spring.ldap.password1=pass1
spring.ldap.username2=user2,ou=people,o=internet
spring.ldap.password2=pass2
spring.ldap.urls=ldap-url1 ldap-url2

While this let's me authenticate with both Ldaps successfully, I would like also my Actuator /health endpoint to report status of both Ldaps, but currently I am getting only one reported like:

"ldap": {
  "details": {
    "version": 3
  },
  "status": "UP"
}

I would expect it to report status on both Ldaps in question. How do I do that?

Also, how would I add to the Ldap /health actuator something like say "name" to distinguish btw Active Directory Ldap and OpenLdap?


Solution

  • Following same logic as described here https://www.javadevjournal.com/spring-security/spring-security-multiple-authentication-providers/, , and this Youtube https://www.youtube.com/watch?v=ElY3rjtukig

    , I was able to resolve this.