Class CrowdUserDetails
java.lang.Object
com.atlassian.crowd.integration.springsecurity.user.CrowdUserDetails
- All Implemented Interfaces:
Serializable,org.springframework.security.core.userdetails.UserDetails
public class CrowdUserDetails
extends Object
implements org.springframework.security.core.userdetails.UserDetails
Implements a basic UserWithAttributes wrapper for Crowd principals.
All attributes on this object are obtained directly from
the Crowd server.
- Author:
- Shihab Hamid
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCrowdUserDetails(User principal, Collection<org.springframework.security.core.GrantedAuthority> authorities) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAttribute(String attributeName) Collection<org.springframework.security.core.GrantedAuthority>Returns the authorities granted to the user.getEmail()Returns the password used to authenticate the user.Returns the remote principal that has authenticated.Returns the username used to authenticate the user.booleanhasAuthority(Predicate<org.springframework.security.core.GrantedAuthority> authorityPredicate) 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.
-
Constructor Details
-
CrowdUserDetails
public CrowdUserDetails(User principal, Collection<org.springframework.security.core.GrantedAuthority> authorities)
-
-
Method Details
-
getAuthorities
Returns the authorities granted to the user. Cannot returnnull.- Specified by:
getAuthoritiesin interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
- the authorities (never
null)
-
getRemotePrincipal
Returns the remote principal that has authenticated. Before Crowd 2.7, this method was returning SOAPPrincipal. In Crowd 2.7, the return type was changed to the API-neutral UserWithAttributes. Applications using this method will have to be updated.- Returns:
- remote principal
-
getPassword
Returns the password used to authenticate the user. Cannot returnnull.- Specified by:
getPasswordin interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
- the password (never
null). Always throws UnsupportedOperationException as we don't want to risk exposing the password of a user.
-
getUsername
Returns the username used to authenticate the user. Cannot returnnull.- Specified by:
getUsernamein interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
- the username (never
null)
-
isAccountNonExpired
public boolean isAccountNonExpired()Indicates whether the user's account has expired. An expired account cannot be authenticated.- Specified by:
isAccountNonExpiredin interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
truealways.
-
isAccountNonLocked
public boolean isAccountNonLocked()Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.- Specified by:
isAccountNonLockedin interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
truealways.
-
isCredentialsNonExpired
public boolean isCredentialsNonExpired()Indicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.- Specified by:
isCredentialsNonExpiredin interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
truealways.
-
isEnabled
public boolean isEnabled()Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.- Specified by:
isEnabledin interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
trueif the user is active,falseotherwise.
-
getFirstName
-
getLastName
-
getEmail
-
getAttribute
-
getFullName
-
hasAuthority
public boolean hasAuthority(Predicate<org.springframework.security.core.GrantedAuthority> authorityPredicate) -
equals
-
hashCode
public int hashCode()
-