Class LdapActorLoginMapper

java.lang.Object
de.gustavblass.fsu.fmi.roombooking.security.LdapActorLoginMapper
All Implemented Interfaces:
org.springframework.security.ldap.userdetails.UserDetailsContextMapper

public class LdapActorLoginMapper extends Object implements org.springframework.security.ldap.userdetails.UserDetailsContextMapper
Retrieves the Actor that belongs to a given LDAP user from the local database.
Implementation Note:
This class is not a record, in order not to expose the actorService.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • actorService

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

    • LdapActorLoginMapper

      public LdapActorLoginMapper(@NonNull @NonNull ActorService actorService)
      Constructs a new LdapActorLoginMapper with the given actorService.
      Parameters:
      actorService - The ActorService for database access.
  • Method Details

    • mapUserFromContext

      public org.springframework.security.core.userdetails.UserDetails mapUserFromContext(@Nullable @Nullable org.springframework.ldap.core.DirContextOperations ignoredContext, @NonNull @NonNull String userName, @Nullable @Nullable Collection<? extends org.springframework.security.core.GrantedAuthority> ignoredAuthorities) throws org.springframework.security.core.userdetails.UsernameNotFoundException
      Retrieves the Actor with the given Actor.userName from the local database.
      Specified by:
      mapUserFromContext in interface org.springframework.security.ldap.userdetails.UserDetailsContextMapper
      Parameters:
      ignoredContext - The LDAP server's response with the user data is irrelevant here, since all user data is retrieved exclusively from the local database.
      userName - The user name of the Actor that shall be fetched from the database.
      ignoredAuthorities - Also irrelevant.
      Returns:
      The Actor that has the given user name, fetched from the local database.
      Throws:
      org.springframework.security.core.userdetails.UsernameNotFoundException
    • mapUserToContext

      @Contract("_, _ -> fail") public void mapUserToContext(@Nullable @Nullable org.springframework.security.core.userdetails.UserDetails ignoredUser, @Nullable @Nullable org.springframework.ldap.core.DirContextAdapter ignoredContext) throws org.apache.commons.lang3.NotImplementedException
      Warning! Not implemented!
      Specified by:
      mapUserToContext in interface org.springframework.security.ldap.userdetails.UserDetailsContextMapper
      Throws:
      org.apache.commons.lang3.NotImplementedException - Always!