Class OpaqueTokenAuthenticationProvider
- java.lang.Object
-
- org.springframework.security.oauth2.server.resource.authentication.OpaqueTokenAuthenticationProvider
-
- All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider
public final class OpaqueTokenAuthenticationProvider extends java.lang.Object implements org.springframework.security.authentication.AuthenticationProviderAnAuthenticationProviderimplementation for opaque Bearer Tokens, using an OAuth 2.0 Introspection Endpoint to check the token's validity and reveal its attributes.This
AuthenticationProvideris responsible for introspecting and verifying an opaque access token, returning its attributes set as part of theAuthenticationstatement.Scopes are translated into
GrantedAuthoritys according to the following algorithm:- If there is a "scope" attribute, then convert to a
CollectionofStrings. - Take the resulting
Collectionand prepend the "SCOPE_" keyword to each element, adding asGrantedAuthoritys.
- Since:
- 5.2
- See Also:
AuthenticationProvider
-
-
Constructor Summary
Constructors Constructor Description OpaqueTokenAuthenticationProvider(OpaqueTokenIntrospector introspector)Creates aOpaqueTokenAuthenticationProviderwith the provided parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.core.Authenticationauthenticate(org.springframework.security.core.Authentication authentication)Introspect and validate the opaque Bearer Token.booleansupports(java.lang.Class<?> authentication)
-
-
-
Constructor Detail
-
OpaqueTokenAuthenticationProvider
public OpaqueTokenAuthenticationProvider(OpaqueTokenIntrospector introspector)
Creates aOpaqueTokenAuthenticationProviderwith the provided parameters- Parameters:
introspector- TheOpaqueTokenIntrospectorto use
-
-
Method Detail
-
authenticate
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationExceptionIntrospect and validate the opaque Bearer Token.- Specified by:
authenticatein interfaceorg.springframework.security.authentication.AuthenticationProvider- Parameters:
authentication- the authentication request object.- Returns:
- A successful authentication
- Throws:
org.springframework.security.core.AuthenticationException- if authentication failed for some reason
-
supports
public boolean supports(java.lang.Class<?> authentication)
- Specified by:
supportsin interfaceorg.springframework.security.authentication.AuthenticationProvider
-
-