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 Details

    • CrowdUserDetails

      public CrowdUserDetails(User principal, Collection<org.springframework.security.core.GrantedAuthority> authorities)
  • Method Details

    • getAuthorities

      public Collection<org.springframework.security.core.GrantedAuthority> getAuthorities()
      Returns the authorities granted to the user. Cannot return null.
      Specified by:
      getAuthorities in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      the authorities (never null)
    • getRemotePrincipal

      public User 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

      public String getPassword()
      Returns the password used to authenticate the user. Cannot return null.
      Specified by:
      getPassword in interface org.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

      public String getUsername()
      Returns the username used to authenticate the user. Cannot return null.
      Specified by:
      getUsername in interface org.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 interface org.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 interface org.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 interface org.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 interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the user is active, false otherwise.
    • getFirstName

      public String getFirstName()
    • getLastName

      public String getLastName()
    • getEmail

      public String getEmail()
    • getAttribute

      public String getAttribute(String attributeName)
    • getFullName

      public String getFullName()
    • hasAuthority

      public boolean hasAuthority(Predicate<org.springframework.security.core.GrantedAuthority> authorityPredicate)
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object