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 Details

    • actorService

      @NonNull private final @NonNull ActorService actorService
      Used to fetch a given user's data from the database.
  • Constructor Details

  • Method Details

    • getGrantedAuthorities

      public Collection<? extends org.springframework.security.core.GrantedAuthority> getGrantedAuthorities(@NonNull @NonNull org.springframework.ldap.core.DirContextOperations ignored, @NonNull @NonNull String userName)
      Checks which ActorRole the Actor with the given Actor.userName has.
      Specified by:
      getGrantedAuthorities in interface org.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 - The Actor.userName.
      Returns:
      A List with no more than one item (the Actor.role). Empty if no Actor with the given user name exists.