Query LDAP users with Spring Security LDAP in Grails?
-
21-12-2019 - |
Pregunta
I want to get the list of all users in a specific group of an LDAP directory, and also I'm using Spring Security LDAP; and I cant find any thing that could solve my issue.
I'm already have Spring Security LDAP and I can get context
and principal
and so on.
I also read my Spring Security LDAP plugin functions but found nothing to get list of all users.
What should I do? Did I have to make a query? If yes, how?
Solución
In context of spring security, the framework only aims to find the LDAP user and then verifies if the passwords are correct.
The loading of roles can be done multiple ways, but usually boils down to:
- Specifying which LDAP User attributes should be loaded as Roles
- Provide your own custom 'role' mapper, as described in Handling roles when authenticated to active directory with spring security 3.1
If you want to do some plain LDAP Search outside of the Spring security context, I would suggest you take a look at the example in chapter 1.2 of the Spring LDAP Reference guide. http://docs.spring.io/spring-ldap/docs/current-SNAPSHOT/reference/#traditional-java-ldap-v-s-ldaptemplate