Class CrowdUserDetailsServiceImpl

java.lang.Object
com.atlassian.crowd.integration.springsecurity.user.CrowdUserDetailsServiceImpl
All Implemented Interfaces:
CrowdUserDetailsService, org.springframework.security.core.userdetails.UserDetailsService

public class CrowdUserDetailsServiceImpl extends Object implements CrowdUserDetailsService
Retrieves users from Crowd using Crowd's remote API.
Author:
Shihab Hamid
  • Constructor Details

    • CrowdUserDetailsServiceImpl

      public CrowdUserDetailsServiceImpl()
  • Method Details

    • loadUserByUsername

      public CrowdUserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException, org.springframework.dao.DataAccessException
      Description copied from interface: CrowdUserDetailsService
      Retrieves the user from Crowd by looking up the principal by username.
      Specified by:
      loadUserByUsername in interface CrowdUserDetailsService
      Specified by:
      loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsService
      Parameters:
      username - username of the principal.
      Returns:
      CrowdUserDetails corresponding to the principal.
      Throws:
      org.springframework.dao.DataAccessException - thrown if there was an underlying problem while communicating with the Crowd server.
      org.springframework.security.core.userdetails.UsernameNotFoundException
    • loadUserByToken

      public CrowdUserDetails loadUserByToken(String token) throws CrowdSSOTokenInvalidException, org.springframework.dao.DataAccessException
      Description copied from interface: CrowdUserDetailsService
      Retrieve a user from Crowd by looking up the principal by their authenticated Crowd token.
      Specified by:
      loadUserByToken in interface CrowdUserDetailsService
      Parameters:
      token - Crowd SSO token string.
      Returns:
      CrowdUserDetails corresponding to the principal.
      Throws:
      org.springframework.dao.DataAccessException - thrown if there was an underlying problem while communicating with the Crowd server.
      CrowdSSOTokenInvalidException
    • getAuthorityPrefix

      public String getAuthorityPrefix()
      Description copied from interface: CrowdUserDetailsService
      Return the authority prefix applied to group names the principal is a member of when generating the GrantedAuthority[] and no authorityMap is set.
      Specified by:
      getAuthorityPrefix in interface CrowdUserDetailsService
      Returns:
      prefix.
    • setAuthorityPrefix

      public void setAuthorityPrefix(String authorityPrefix)
      Description copied from interface: CrowdUserDetailsService
      Set the authority prefix applied to group names the principal is a member of when generating the GrantedAuthority[] and no authorityMap is set, e.g. ROLE_crowd-administrators.
      Specified by:
      setAuthorityPrefix in interface CrowdUserDetailsService
      Parameters:
      authorityPrefix - prefix to apply. The default is no prefix.
    • getGroupToAuthorityMappings

      public Iterable<Map.Entry<String,String>> getGroupToAuthorityMappings()
      Description copied from interface: CrowdUserDetailsService
      Return the group-to-authority mappings
      Specified by:
      getGroupToAuthorityMappings in interface CrowdUserDetailsService
      Returns:
      an iterable over mappings from group names (key) to authority names (value)
    • setGroupToAuthorityMappings

      public void setGroupToAuthorityMappings(Iterable<Map.Entry<String,String>> groupToAuthorityMappings)
      Description copied from interface: CrowdUserDetailsService
      Set the authority mappings. The default is no authority mappings, which implies that authorities are derived from group names, with an optional authorityPrefix. If not null, the mappings are used instead to transform group names into authority names regardless of the authorityPrefix.

      Versions of Crowd prior to 2.6 used to have a configurable authoritySuffix parameter which has been replaced by these mappings.

      Specified by:
      setGroupToAuthorityMappings in interface CrowdUserDetailsService
      Parameters:
      groupToAuthorityMappings - authority mappings. If absent, an authority prefix is used.
    • setUserAuthoritiesProvider

      public void setUserAuthoritiesProvider(UserAuthoritiesProvider userAuthoritiesProvider)
      Set a User to Authorities provider, eg. to delegate to UserPermissionService. This takes priority over all other methods of Authorities calculations.
      Parameters:
      userAuthoritiesProvider - the implementation to use
    • getAdminAuthority

      public String getAdminAuthority()
      Description copied from interface: CrowdUserDetailsService
      Return the name of the admin authority.
      Specified by:
      getAdminAuthority in interface CrowdUserDetailsService
      Returns:
      name of the admin authority
    • setAdminAuthority

      public void setAdminAuthority(String adminAuthority)
      Set the name of the admin authority.
      Specified by:
      setAdminAuthority in interface CrowdUserDetailsService
      Parameters:
      adminAuthority - name of the admin authority. The default is ROLE_SYS_ADMIN.
    • setCrowdClient

      public void setCrowdClient(CrowdClient crowdClient)