Class UserDetailsLdapMapper

  • All Implemented Interfaces:
    org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>, org.ldaptive.beans.LdapEntryMapper<org.springframework.security.core.userdetails.UserDetails>

    public class UserDetailsLdapMapper
    extends Object
    implements org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
    The user details mapper.
    Author:
    Christian Bremer
    • 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 name
        userAccountControlAttributeName - the user account control attribute name
        authorities - the authorities
        authorityAttributeName - the authority attribute name
        authorityDn - the authority dn
        authorityMap - the authority map
        authorityPrefix - the authority prefix
    • Method Detail

      • getObjectClasses

        public String[] getObjectClasses()
        Specified by:
        getObjectClasses in interface org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
      • mapDn

        public String mapDn​(org.springframework.security.core.userdetails.UserDetails domainObject)
        Specified by:
        mapDn in interface org.ldaptive.beans.LdapEntryMapper<org.springframework.security.core.userdetails.UserDetails>
        Specified by:
        mapDn in interface org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
      • map

        public org.springframework.security.core.userdetails.UserDetails map​(org.ldaptive.LdapEntry ldapEntry)
        Specified by:
        map in interface org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
      • map

        public void map​(org.ldaptive.LdapEntry source,
                        org.springframework.security.core.userdetails.UserDetails destination)
        Specified by:
        map in interface org.ldaptive.beans.LdapEntryMapper<org.springframework.security.core.userdetails.UserDetails>
        Specified by:
        map in interface org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
      • mapAndComputeModifications

        public org.ldaptive.AttributeModification[] mapAndComputeModifications​(org.springframework.security.core.userdetails.UserDetails source,
                                                                               org.ldaptive.LdapEntry destination)
        Specified by:
        mapAndComputeModifications in interface org.bremersee.data.ldaptive.LdaptiveEntryMapper<org.springframework.security.core.userdetails.UserDetails>
      • 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
      • prefixAuthority

        protected static String prefixAuthority​(String prefix,
                                                String value)
        Prefix authority.
        Parameters:
        prefix - the prefix
        value - the value
        Returns:
        the string