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 TypeMethodDescriptionboolean
getAttribute
(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.boolean
hasAuthority
(Predicate<org.springframework.security.core.GrantedAuthority> authorityPredicate) int
hashCode()
boolean
Indicates whether the user's account has expired.boolean
Indicates whether the user is locked or unlocked.boolean
Indicates whether the user's credentials (password) has expired.boolean
Indicates 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:
getAuthorities
in 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:
getPassword
in 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:
getUsername
in 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:
isAccountNonExpired
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
true
always.
-
isAccountNonLocked
public boolean isAccountNonLocked()Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.- Specified by:
isAccountNonLocked
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
true
always.
-
isCredentialsNonExpired
public boolean isCredentialsNonExpired()Indicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.- Specified by:
isCredentialsNonExpired
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
true
always.
-
isEnabled
public boolean isEnabled()Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.- Specified by:
isEnabled
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
true
if the user is active,false
otherwise.
-
getFirstName
-
getLastName
-
getEmail
-
getAttribute
-
getFullName
-
hasAuthority
public boolean hasAuthority(Predicate<org.springframework.security.core.GrantedAuthority> authorityPredicate) -
equals
-
hashCode
public int hashCode()
-