Reputation: 8810
I've set up Spring Security so that it will authenticate against a Active Directory. How can I get a list of all the users in my @Controller?
Background: I have a controller where I want the admin to be able to assign different users into groups. I want to provide a list of users she can select from, and this should be a filtered list of users in the AD.
Cheers
Nik
Upvotes: 0
Views: 602
Reputation: 370
In Spring Security you can get List of all users those are currently logged-in into the system. by using this code in your controller.
@Autowired
private SessionRegistryImpl sessionRegistry;
List principals = sessionRegistry.getAllPrincipals();
Upvotes: 0
Reputation: 12942
You need to retrieve it from AD, spring security not provide, or store list of users, it is using AD for that and use AuthenticationManager to integrate with AD or DB contains the users profiles.
Upvotes: 3