Class LdapUserDetailsImpl

java.lang.Object
org.springframework.security.ldap.userdetails.LdapUserDetailsImpl
All Implemented Interfaces:
Serializable, org.springframework.security.core.CredentialsContainer, org.springframework.security.core.userdetails.UserDetails, PasswordPolicyData, LdapUserDetails
Direct Known Subclasses:
Person

public class LdapUserDetailsImpl extends Object implements LdapUserDetails, PasswordPolicyData
A UserDetails implementation which is used internally by the Ldap services. It also contains the user's distinguished name and a set of attributes that have been retrieved from the Ldap server.

An instance may be created as the result of a search, or when user information is retrieved during authentication.

An instance of this class will be used by the LdapAuthenticationProvider to construct the final user details object that it returns.

The equals and hashcode methods are implemented using the Dn property and do not consider additional state, so it is not possible two store two instances with the same DN in the same set, or use them as keys in a map.

See Also:
  • Constructor Details

    • LdapUserDetailsImpl

      protected LdapUserDetailsImpl()
  • Method Details

    • getAuthorities

      public Collection<org.springframework.security.core.GrantedAuthority> getAuthorities()
      Specified by:
      getAuthorities in interface org.springframework.security.core.userdetails.UserDetails
    • getDn

      public String getDn()
      Description copied from interface: LdapUserDetails
      The DN of the entry for this user's account.
      Specified by:
      getDn in interface LdapUserDetails
      Returns:
      the user's DN
    • getPassword

      public String getPassword()
      Specified by:
      getPassword in interface org.springframework.security.core.userdetails.UserDetails
    • getUsername

      public String getUsername()
      Specified by:
      getUsername in interface org.springframework.security.core.userdetails.UserDetails
    • isAccountNonExpired

      public boolean isAccountNonExpired()
      Specified by:
      isAccountNonExpired in interface org.springframework.security.core.userdetails.UserDetails
    • isAccountNonLocked

      public boolean isAccountNonLocked()
      Specified by:
      isAccountNonLocked in interface org.springframework.security.core.userdetails.UserDetails
    • isCredentialsNonExpired

      public boolean isCredentialsNonExpired()
      Specified by:
      isCredentialsNonExpired in interface org.springframework.security.core.userdetails.UserDetails
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface org.springframework.security.core.userdetails.UserDetails
    • eraseCredentials

      public void eraseCredentials()
      Specified by:
      eraseCredentials in interface org.springframework.security.core.CredentialsContainer
    • getTimeBeforeExpiration

      public int getTimeBeforeExpiration()
      Specified by:
      getTimeBeforeExpiration in interface PasswordPolicyData
    • getGraceLoginsRemaining

      public int getGraceLoginsRemaining()
      Specified by:
      getGraceLoginsRemaining in interface PasswordPolicyData
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object