public final class OpaqueTokenAuthenticationProvider extends java.lang.Object implements AuthenticationProvider
AuthenticationProvider implementation for opaque
Bearer Tokens,
using an
OAuth 2.0 Introspection Endpoint
to check the token's validity and reveal its attributes.
This AuthenticationProvider is responsible for introspecting and verifying an opaque access token,
returning its attributes set as part of the Authentication statement.
Scopes are translated into GrantedAuthoritys according to the following algorithm:
Collection of Strings.
Collection and prepend the "SCOPE_" keyword to each element, adding as GrantedAuthoritys.
AuthenticationProvider| Constructor and Description |
|---|
OpaqueTokenAuthenticationProvider(OpaqueTokenIntrospector introspector)
Creates a
OpaqueTokenAuthenticationProvider with the provided parameters |
| Modifier and Type | Method and Description |
|---|---|
Authentication |
authenticate(Authentication authentication)
Introspect and validate the opaque
Bearer Token.
|
boolean |
supports(java.lang.Class<?> authentication)
Returns
true if this AuthenticationProvider supports the
indicated Authentication object. |
public OpaqueTokenAuthenticationProvider(OpaqueTokenIntrospector introspector)
OpaqueTokenAuthenticationProvider with the provided parametersintrospector - The OpaqueTokenIntrospector to usepublic Authentication authenticate(Authentication authentication) throws AuthenticationException
authenticate in interface AuthenticationProviderauthentication - the authentication request object.AuthenticationException - if authentication failed for some reasonpublic boolean supports(java.lang.Class<?> authentication)
true if this AuthenticationProvider supports the
indicated Authentication object.
Returning true does not guarantee an
AuthenticationProvider will be able to authenticate the presented
instance of the Authentication class. It simply indicates it can
support closer evaluation of it. An AuthenticationProvider can still
return null from the AuthenticationProvider.authenticate(Authentication) method to
indicate another AuthenticationProvider should be tried.
Selection of an AuthenticationProvider capable of performing
authentication is conducted at runtime the ProviderManager.
supports in interface AuthenticationProvidertrue if the implementation can more closely evaluate the
Authentication class presented