Class LdapUserDetailsImpl
java.lang.Object
org.springframework.security.ldap.userdetails.LdapUserDetailsImpl
- All Implemented Interfaces:
Serializable,CredentialsContainer,UserDetails,PasswordPolicyData,LdapUserDetails
- Direct Known Subclasses:
Person
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classVariation of essence pattern. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidReturns the authorities granted to the user.getDn()The DN of the entry for this user's account.intReturns the password used to authenticate the user.intReturns the username used to authenticate the user.inthashCode()booleanIndicates whether the user's account has expired.booleanIndicates whether the user is locked or unlocked.booleanIndicates whether the user's credentials (password) has expired.booleanIndicates whether the user is enabled or disabled.toString()
-
Constructor Details
-
LdapUserDetailsImpl
protected LdapUserDetailsImpl()
-
-
Method Details
-
getAuthorities
Description copied from interface:UserDetailsReturns the authorities granted to the user. Cannot returnnull.- Specified by:
getAuthoritiesin interfaceUserDetails- Returns:
- the authorities, sorted by natural key (never
null)
-
getDn
Description copied from interface:LdapUserDetailsThe DN of the entry for this user's account.- Specified by:
getDnin interfaceLdapUserDetails- Returns:
- the user's DN
-
getPassword
Description copied from interface:UserDetailsReturns the password used to authenticate the user.- Specified by:
getPasswordin interfaceUserDetails- Returns:
- the password
-
getUsername
Description copied from interface:UserDetailsReturns the username used to authenticate the user. Cannot returnnull.- Specified by:
getUsernamein interfaceUserDetails- Returns:
- the username (never
null)
-
isAccountNonExpired
public boolean isAccountNonExpired()Description copied from interface:UserDetailsIndicates whether the user's account has expired. An expired account cannot be authenticated.- Specified by:
isAccountNonExpiredin interfaceUserDetails- Returns:
trueif the user's account is valid (ie non-expired),falseif no longer valid (ie expired)
-
isAccountNonLocked
public boolean isAccountNonLocked()Description copied from interface:UserDetailsIndicates whether the user is locked or unlocked. A locked user cannot be authenticated.- Specified by:
isAccountNonLockedin interfaceUserDetails- Returns:
trueif the user is not locked,falseotherwise
-
isCredentialsNonExpired
public boolean isCredentialsNonExpired()Description copied from interface:UserDetailsIndicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.- Specified by:
isCredentialsNonExpiredin interfaceUserDetails- Returns:
trueif the user's credentials are valid (ie non-expired),falseif no longer valid (ie expired)
-
isEnabled
public boolean isEnabled()Description copied from interface:UserDetailsIndicates whether the user is enabled or disabled. A disabled user cannot be authenticated.- Specified by:
isEnabledin interfaceUserDetails- Returns:
trueif the user is enabled,falseotherwise
-
eraseCredentials
public void eraseCredentials()- Specified by:
eraseCredentialsin interfaceCredentialsContainer
-
getTimeBeforeExpiration
public int getTimeBeforeExpiration()- Specified by:
getTimeBeforeExpirationin interfacePasswordPolicyData
-
getGraceLoginsRemaining
public int getGraceLoginsRemaining()- Specified by:
getGraceLoginsRemainingin interfacePasswordPolicyData
-
equals
-
hashCode
public int hashCode() -
toString
-