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
- 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 givenActordata from the database.private static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionLdapActorLoginMapper(@NonNull ActorService actorService) Constructs a newLdapActorLoginMapperwith the givenactorService. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.userdetails.UserDetailsmapUserFromContext(@Nullable org.springframework.ldap.core.DirContextOperations ignoredContext, @NonNull String userName, @Nullable Collection<? extends org.springframework.security.core.GrantedAuthority> ignoredAuthorities) Retrieves theActorwith the givenActor.userNamefrom the local database.voidmapUserToContext(@Nullable org.springframework.security.core.userdetails.UserDetails ignoredUser, @Nullable org.springframework.ldap.core.DirContextAdapter ignoredContext) Warning! Not implemented!
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
actorService
Used to fetch a givenActordata from the database.
-
-
Constructor Details
-
LdapActorLoginMapper
Constructs a newLdapActorLoginMapperwith the givenactorService.- 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 theActorwith the givenActor.userNamefrom the local database.- Specified by:
mapUserFromContextin interfaceorg.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:
mapUserToContextin interfaceorg.springframework.security.ldap.userdetails.UserDetailsContextMapper- Throws:
org.apache.commons.lang3.NotImplementedException- Always!
-