Class PreAuthenticatedGrantedAuthoritiesUserDetailsService

  • All Implemented Interfaces:
    org.springframework.security.core.userdetails.AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken>

    public class PreAuthenticatedGrantedAuthoritiesUserDetailsService
    extends java.lang.Object
    implements org.springframework.security.core.userdetails.AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken>

    This AuthenticationUserDetailsService implementation creates a UserDetails object based solely on the information contained in the given PreAuthenticatedAuthenticationToken. The user name is set to the name as returned by PreAuthenticatedAuthenticationToken.getName(), the password is set to a fixed dummy value (it will not be used by the PreAuthenticatedAuthenticationProvider anyway), and the Granted Authorities are retrieved from the details object as returned by PreAuthenticatedAuthenticationToken.getDetails().

    The details object as returned by PreAuthenticatedAuthenticationToken.getDetails() must implement the GrantedAuthoritiesContainer interface for this implementation to work.

    Since:
    2.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.security.core.userdetails.UserDetails createUserDetails​(org.springframework.security.core.Authentication token, java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
      Creates the final UserDetails object.
      org.springframework.security.core.userdetails.UserDetails loadUserDetails​(PreAuthenticatedAuthenticationToken token)
      Get a UserDetails object based on the user name contained in the given token, and the GrantedAuthorities as returned by the GrantedAuthoritiesContainer implementation as returned by the token.getDetails() method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PreAuthenticatedGrantedAuthoritiesUserDetailsService

        public PreAuthenticatedGrantedAuthoritiesUserDetailsService()
    • Method Detail

      • loadUserDetails

        public final org.springframework.security.core.userdetails.UserDetails loadUserDetails​(PreAuthenticatedAuthenticationToken token)
                                                                                        throws org.springframework.security.core.AuthenticationException
        Get a UserDetails object based on the user name contained in the given token, and the GrantedAuthorities as returned by the GrantedAuthoritiesContainer implementation as returned by the token.getDetails() method.
        Specified by:
        loadUserDetails in interface org.springframework.security.core.userdetails.AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken>
        Throws:
        org.springframework.security.core.AuthenticationException
      • createUserDetails

        protected org.springframework.security.core.userdetails.UserDetails createUserDetails​(org.springframework.security.core.Authentication token,
                                                                                              java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
        Creates the final UserDetails object. Can be overridden to customize the contents.
        Parameters:
        token - the authentication request token
        authorities - the pre-authenticated authorities.