Class LdapDatabaseActorPopulator
java.lang.Object
de.gustavblass.fsu.fmi.roombooking.security.LdapDatabaseActorPopulator
- All Implemented Interfaces:
org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator
public class LdapDatabaseActorPopulator
extends Object
implements org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator
Used to determine an LDAP user's
Actor.role.- Implementation Note:
- This class is not a record, in order not to expose the
actorService.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull ActorServiceUsed to fetch a given user's data from the database. -
Constructor Summary
ConstructorsConstructorDescriptionLdapDatabaseActorPopulator(@NonNull ActorService actorService) Constructs a newLdapDatabaseActorPopulatorwith the givenactorService. -
Method Summary
Modifier and TypeMethodDescriptionCollection<? extends org.springframework.security.core.GrantedAuthority> getGrantedAuthorities(@NonNull org.springframework.ldap.core.DirContextOperations ignored, @NonNull String userName)
-
Field Details
-
actorService
Used to fetch a given user's data from the database.
-
-
Constructor Details
-
LdapDatabaseActorPopulator
Constructs a newLdapDatabaseActorPopulatorwith the givenactorService.- Parameters:
actorService- The ActorService for database access.
-
-
Method Details
-
getGrantedAuthorities
public Collection<? extends org.springframework.security.core.GrantedAuthority> getGrantedAuthorities(@NonNull @NonNull org.springframework.ldap.core.DirContextOperations ignored, @NonNull @NonNull String userName) - Specified by:
getGrantedAuthoritiesin interfaceorg.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator- Parameters:
ignored- The role information is derived exclusively from the data in the database. The LDAP data is ignored entirely.userName- TheActor.userName.- Returns:
- A
Listwith no more than one item (theActor.role). Empty if no Actor with the given user name exists.
-