Class SpringOpaqueTokenIntrospector
java.lang.Object
org.springframework.security.oauth2.server.resource.introspection.SpringOpaqueTokenIntrospector
- All Implemented Interfaces:
OpaqueTokenIntrospector
A Spring implementation of
OpaqueTokenIntrospector
that verifies and
introspects a token using the configured
OAuth 2.0 Introspection
Endpoint.- Since:
- 5.6
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSpringOpaqueTokenIntrospector
(String introspectionUri, String clientId, String clientSecret) Deprecated, for removal: This API element is subject to removal in a future version.SpringOpaqueTokenIntrospector
(String introspectionUri, org.springframework.web.client.RestOperations restOperations) Creates aOpaqueTokenAuthenticationProvider
with the provided parameters The givenRestOperations
should perform its own client authentication against the introspection endpoint. -
Method Summary
Modifier and TypeMethodDescriptionintrospect
(String token) Introspect and verify the given token, returning its attributes.void
setAuthenticationConverter
(org.springframework.core.convert.converter.Converter<OAuth2TokenIntrospectionClaimAccessor, ? extends OAuth2AuthenticatedPrincipal> authenticationConverter) Sets theConverter<OAuth2TokenIntrospectionClaimAccessor, OAuth2AuthenticatedPrincipal>
to use.void
setRequestEntityConverter
(org.springframework.core.convert.converter.Converter<String, org.springframework.http.RequestEntity<?>> requestEntityConverter) Sets theConverter
used for converting the OAuth 2.0 access token to aRequestEntity
representation of the OAuth 2.0 token introspection request.withIntrospectionUri
(String introspectionUri) Creates aSpringOpaqueTokenIntrospector.Builder
with the given introspection endpoint uri
-
Constructor Details
-
SpringOpaqueTokenIntrospector
@Deprecated(since="6.5", forRemoval=true) public SpringOpaqueTokenIntrospector(String introspectionUri, String clientId, String clientSecret) Deprecated, for removal: This API element is subject to removal in a future version.Please useSpringOpaqueTokenIntrospector.Builder
Creates aOpaqueTokenAuthenticationProvider
with the provided parameters- Parameters:
introspectionUri
- The introspection endpoint uriclientId
- The URL-encoded client id authorized to introspectclientSecret
- The URL-encoded client secret authorized to introspect
-
SpringOpaqueTokenIntrospector
public SpringOpaqueTokenIntrospector(String introspectionUri, org.springframework.web.client.RestOperations restOperations) Creates aOpaqueTokenAuthenticationProvider
with the provided parameters The givenRestOperations
should perform its own client authentication against the introspection endpoint.- Parameters:
introspectionUri
- The introspection endpoint urirestOperations
- The client for performing the introspection request
-
-
Method Details
-
introspect
Description copied from interface:OpaqueTokenIntrospector
Introspect and verify the given token, returning its attributes. Returning aMap
is indicative that the token is valid.- Specified by:
introspect
in interfaceOpaqueTokenIntrospector
- Parameters:
token
- the token to introspect- Returns:
- the token's attributes
-
setRequestEntityConverter
public void setRequestEntityConverter(org.springframework.core.convert.converter.Converter<String, org.springframework.http.RequestEntity<?>> requestEntityConverter) Sets theConverter
used for converting the OAuth 2.0 access token to aRequestEntity
representation of the OAuth 2.0 token introspection request.- Parameters:
requestEntityConverter
- theConverter
used for converting to aRequestEntity
representation of the token introspection request
-
setAuthenticationConverter
public void setAuthenticationConverter(org.springframework.core.convert.converter.Converter<OAuth2TokenIntrospectionClaimAccessor, ? extends OAuth2AuthenticatedPrincipal> authenticationConverter) Sets the
Converter<OAuth2TokenIntrospectionClaimAccessor, OAuth2AuthenticatedPrincipal>
to use. Defaults todefaultAuthenticationConverter(org.springframework.security.oauth2.core.OAuth2TokenIntrospectionClaimAccessor)
.Use if you need a custom mapping of OAuth 2.0 token claims to the authenticated principal.
- Parameters:
authenticationConverter
- the converter- Since:
- 6.3
-
withIntrospectionUri
Creates aSpringOpaqueTokenIntrospector.Builder
with the given introspection endpoint uri- Parameters:
introspectionUri
- The introspection endpoint uri- Returns:
- the
SpringOpaqueTokenIntrospector.Builder
- Since:
- 6.5
-
SpringOpaqueTokenIntrospector.Builder