Class UserDetailsLdapMapper
- java.lang.Object
-
- org.bremersee.security.core.userdetails.UserDetailsLdapMapper
-
- All Implemented Interfaces:
LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
,org.ldaptive.beans.LdapEntryMapper<org.springframework.security.core.userdetails.UserDetails>
public class UserDetailsLdapMapper extends Object implements LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
The user details mapper.- Author:
- Christian Bremer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
UserDetailsLdapMapper.GrantedAuthorityValueTranscoder
The granted authority value transcoder.
-
Constructor Summary
Constructors Constructor Description UserDetailsLdapMapper(String userName, String userAccountControlAttributeName, List<String> authorities, String authorityAttributeName, boolean authorityDn, Map<String,String> authorityMap, String authorityPrefix)
Instantiates a new user details mapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<? extends org.springframework.security.core.GrantedAuthority>
getGrantedAuthorities(org.ldaptive.LdapEntry ldapEntry)
Gets granted authorities.String[]
getObjectClasses()
Get object classes of the ldap entry.protected boolean
isAccountEnabled(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account is enabled or not.protected boolean
isAccountNonExpired(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account is not expired.protected boolean
isAccountNonLocked(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account is not locked.protected boolean
isCredentialsNonExpired(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account credentials are not expired.org.springframework.security.core.userdetails.UserDetails
map(org.ldaptive.LdapEntry ldapEntry)
Map a ldap entry into a domain object.void
map(org.ldaptive.LdapEntry source, org.springframework.security.core.userdetails.UserDetails destination)
org.ldaptive.AttributeModification[]
mapAndComputeModifications(org.springframework.security.core.userdetails.UserDetails source, org.ldaptive.LdapEntry destination)
Map and compute attribute modifications (seeLdapEntry.computeModifications(LdapEntry, LdapEntry)
**).String
mapDn(org.springframework.security.core.userdetails.UserDetails domainObject)
protected static String
prefixAuthority(String prefix, String value)
Prefix authority.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bremersee.data.ldaptive.LdaptiveEntryMapper
map, mapAndComputeModifyRequest
-
-
-
-
Constructor Detail
-
UserDetailsLdapMapper
public UserDetailsLdapMapper(String userName, String userAccountControlAttributeName, List<String> authorities, String authorityAttributeName, boolean authorityDn, Map<String,String> authorityMap, String authorityPrefix)
Instantiates a new user details mapper.- Parameters:
userName
- the user nameuserAccountControlAttributeName
- the user account control attribute nameauthorities
- the authoritiesauthorityAttributeName
- the authority attribute nameauthorityDn
- the authority dnauthorityMap
- the authority mapauthorityPrefix
- the authority prefix
-
-
Method Detail
-
getObjectClasses
public String[] getObjectClasses()
Description copied from interface:LdaptiveEntryMapper
Get object classes of the ldap entry. The object classes are only required, if a new ldap entry should be persisted.- Specified by:
getObjectClasses
in interfaceLdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
- Returns:
- the object classes of the ldap entry
-
mapDn
public String mapDn(org.springframework.security.core.userdetails.UserDetails domainObject)
- Specified by:
mapDn
in interfaceorg.ldaptive.beans.LdapEntryMapper<org.springframework.security.core.userdetails.UserDetails>
- Specified by:
mapDn
in interfaceLdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
-
map
public org.springframework.security.core.userdetails.UserDetails map(org.ldaptive.LdapEntry ldapEntry)
Description copied from interface:LdaptiveEntryMapper
Map a ldap entry into a domain object.- Specified by:
map
in interfaceLdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
- Parameters:
ldapEntry
- the ldap entry- Returns:
- the domain object
-
map
public void map(org.ldaptive.LdapEntry source, org.springframework.security.core.userdetails.UserDetails destination)
- Specified by:
map
in interfaceorg.ldaptive.beans.LdapEntryMapper<org.springframework.security.core.userdetails.UserDetails>
- Specified by:
map
in interfaceLdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
-
mapAndComputeModifications
public org.ldaptive.AttributeModification[] mapAndComputeModifications(org.springframework.security.core.userdetails.UserDetails source, org.ldaptive.LdapEntry destination)
Description copied from interface:LdaptiveEntryMapper
Map and compute attribute modifications (seeLdapEntry.computeModifications(LdapEntry, LdapEntry)
**).- Specified by:
mapAndComputeModifications
in interfaceLdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
- Parameters:
source
- the source (domain object)destination
- the destination (ldap entry)- Returns:
- the attribute modifications
-
isAccountEnabled
protected boolean isAccountEnabled(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account is enabled or not.- Parameters:
ldapEntry
- the ldap entry- Returns:
- the boolean
-
isAccountNonExpired
protected boolean isAccountNonExpired(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account is not expired.- Parameters:
ldapEntry
- the ldap entry- Returns:
- the boolean
-
isCredentialsNonExpired
protected boolean isCredentialsNonExpired(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account credentials are not expired.- Parameters:
ldapEntry
- the ldap entry- Returns:
- the boolean
-
isAccountNonLocked
protected boolean isAccountNonLocked(org.ldaptive.LdapEntry ldapEntry)
Determines whether the account is not locked.- Parameters:
ldapEntry
- the ldap entry- Returns:
- the boolean
-
getGrantedAuthorities
protected Collection<? extends org.springframework.security.core.GrantedAuthority> getGrantedAuthorities(org.ldaptive.LdapEntry ldapEntry)
Gets granted authorities.- Parameters:
ldapEntry
- the ldap entry- Returns:
- the granted authorities
-
-