Class OpaqueTokenAuthenticationProvider
- All Implemented Interfaces:
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:
- 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:
-
Constructor Summary
ConstructorsConstructorDescriptionOpaqueTokenAuthenticationProvider(OpaqueTokenIntrospector introspector) Creates aOpaqueTokenAuthenticationProviderwith the provided parameters -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(Authentication authentication) Introspect and validate the opaque Bearer Token.booleanReturnstrueif thisAuthenticationProvidersupports the indicatedAuthenticationobject.
-
Constructor Details
-
OpaqueTokenAuthenticationProvider
Creates aOpaqueTokenAuthenticationProviderwith the provided parameters- Parameters:
introspector- TheOpaqueTokenIntrospectorto use
-
-
Method Details
-
authenticate
Introspect and validate the opaque Bearer Token.- Specified by:
authenticatein interfaceAuthenticationProvider- Parameters:
authentication- the authentication request object.- Returns:
- A successful authentication
- Throws:
AuthenticationException- if authentication failed for some reason
-
supports
Description copied from interface:AuthenticationProviderReturnstrueif thisAuthenticationProvidersupports the indicatedAuthenticationobject.Returning
truedoes not guarantee anAuthenticationProviderwill be able to authenticate the presented instance of theAuthenticationclass. It simply indicates it can support closer evaluation of it. AnAuthenticationProvidercan still returnnullfrom theAuthenticationProvider.authenticate(Authentication)method to indicate anotherAuthenticationProvidershould be tried.Selection of an
AuthenticationProvidercapable of performing authentication is conducted at runtime theProviderManager.- Specified by:
supportsin interfaceAuthenticationProvider- Returns:
trueif the implementation can more closely evaluate theAuthenticationclass presented
-