Class AbstractOAuth2TokenAuthenticationToken<T extends org.springframework.security.oauth2.core.AbstractOAuth2Token>

  • All Implemented Interfaces:
    java.io.Serializable, java.security.Principal, org.springframework.security.core.Authentication, org.springframework.security.core.CredentialsContainer
    Direct Known Subclasses:
    BearerTokenAuthentication, JwtAuthenticationToken

    public abstract class AbstractOAuth2TokenAuthenticationToken<T extends org.springframework.security.oauth2.core.AbstractOAuth2Token>
    extends org.springframework.security.authentication.AbstractAuthenticationToken
    Base class for AbstractAuthenticationToken implementations that expose common attributes between different OAuth 2.0 Access Token Formats.

    For example, a Jwt could expose its claims via getTokenAttributes() or an "Introspected" OAuth 2.0 Access Token could expose the attributes of the Introspection Response via getTokenAttributes().

    Since:
    5.1
    See Also:
    OAuth2AccessToken, Jwt, 2.2 Introspection Response, Serialized Form
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getCredentials()  
      java.lang.Object getPrincipal()  
      T getToken()
      Get the token bound to this Authentication.
      abstract java.util.Map<java.lang.String,​java.lang.Object> getTokenAttributes()
      Returns the attributes of the access token.
      • Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken

        equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.security.Principal

        implies
    • Constructor Detail

      • AbstractOAuth2TokenAuthenticationToken

        protected AbstractOAuth2TokenAuthenticationToken​(T token)
        Sub-class constructor.
      • AbstractOAuth2TokenAuthenticationToken

        protected AbstractOAuth2TokenAuthenticationToken​(T token,
                                                         java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
        Sub-class constructor.
        Parameters:
        authorities - the authorities assigned to the Access Token
      • AbstractOAuth2TokenAuthenticationToken

        protected AbstractOAuth2TokenAuthenticationToken​(T token,
                                                         java.lang.Object principal,
                                                         java.lang.Object credentials,
                                                         java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
    • Method Detail

      • getPrincipal

        public java.lang.Object getPrincipal()
      • getCredentials

        public java.lang.Object getCredentials()
      • getToken

        public final T getToken()
        Get the token bound to this Authentication.
      • getTokenAttributes

        public abstract java.util.Map<java.lang.String,​java.lang.Object> getTokenAttributes()
        Returns the attributes of the access token.
        Returns:
        a Map of the attributes in the access token.