Class AbstractRestClientOAuth2AccessTokenResponseClient<T extends AbstractOAuth2AuthorizationGrantRequest>
java.lang.Object
org.springframework.security.oauth2.client.endpoint.AbstractRestClientOAuth2AccessTokenResponseClient<T>
- Type Parameters:
T- type of grant request
- All Implemented Interfaces:
OAuth2AccessTokenResponseClient<T>
- Direct Known Subclasses:
RestClientAuthorizationCodeTokenResponseClient,RestClientClientCredentialsTokenResponseClient,RestClientJwtBearerTokenResponseClient,RestClientRefreshTokenTokenResponseClient,RestClientTokenExchangeTokenResponseClient
public abstract class AbstractRestClientOAuth2AccessTokenResponseClient<T extends AbstractOAuth2AuthorizationGrantRequest>
extends Object
implements OAuth2AccessTokenResponseClient<T>
Abstract base class for
RestClient-based implementations of
OAuth2AccessTokenResponseClient that communicate to the Authorization Server's
Token Endpoint.
Submits a form request body specific to the type of grant request and accepts a JSON response body containing an OAuth 2.0 Access Token Response or OAuth 2.0 Error Response.
- Since:
- 6.4
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddHeadersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.http.HttpHeaders> headersConverter) Add (compose) the providedheadersConverterto the currentConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aHttpHeadersused in the OAuth 2.0 Access Token Request headers.final voidaddParametersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.util.MultiValueMap<String, String>> parametersConverter) Add (compose) the providedparametersConverterto the currentConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aMultiValueMapused in the OAuth 2.0 Access Token Request body.org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponsegetTokenResponse(T grantRequest) Exchanges the authorization grant credential, provided in the authorization grant request, for an access token credential at the Authorization Server's Token Endpoint.final voidsetHeadersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.http.HttpHeaders> headersConverter) Sets theConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aHttpHeadersused in the OAuth 2.0 Access Token Request headers.final voidsetParametersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.util.MultiValueMap<String, String>> parametersConverter) Sets theConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aMultiValueMapused in the OAuth 2.0 Access Token Request body.voidsetParametersCustomizer(Consumer<org.springframework.util.MultiValueMap<String, String>> parametersCustomizer) Sets theConsumerused for customizing the OAuth 2.0 Access Token parameters, which allows for parameters to be added, overwritten or removed.final voidsetRestClient(org.springframework.web.client.RestClient restClient) Sets theRestClientused when requesting the OAuth 2.0 Access Token Response.
-
Method Details
-
getTokenResponse
public org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse getTokenResponse(T grantRequest) Description copied from interface:OAuth2AccessTokenResponseClientExchanges the authorization grant credential, provided in the authorization grant request, for an access token credential at the Authorization Server's Token Endpoint.- Specified by:
getTokenResponsein interfaceOAuth2AccessTokenResponseClient<T extends AbstractOAuth2AuthorizationGrantRequest>- Parameters:
grantRequest- the authorization grant request that contains the authorization grant credential- Returns:
- an
OAuth2AccessTokenResponsethat contains theaccess tokencredential
-
setRestClient
public final void setRestClient(org.springframework.web.client.RestClient restClient) Sets theRestClientused when requesting the OAuth 2.0 Access Token Response.- Parameters:
restClient- theRestClientused when requesting the Access Token Response
-
setHeadersConverter
public final void setHeadersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.http.HttpHeaders> headersConverter) Sets theConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aHttpHeadersused in the OAuth 2.0 Access Token Request headers.- Parameters:
headersConverter- theConverterused for converting theAbstractOAuth2AuthorizationGrantRequesttoHttpHeaders
-
addHeadersConverter
public final void addHeadersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.http.HttpHeaders> headersConverter) Add (compose) the providedheadersConverterto the currentConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aHttpHeadersused in the OAuth 2.0 Access Token Request headers.- Parameters:
headersConverter- theConverterto add (compose) to the currentConverterused for converting theAbstractOAuth2AuthorizationGrantRequestto aHttpHeaders
-
setParametersConverter
public final void setParametersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.util.MultiValueMap<String, String>> parametersConverter) Sets theConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aMultiValueMapused in the OAuth 2.0 Access Token Request body.- Parameters:
parametersConverter- theConverterused for converting theAbstractOAuth2AuthorizationGrantRequesttoMultiValueMap
-
addParametersConverter
public final void addParametersConverter(org.springframework.core.convert.converter.Converter<T, org.springframework.util.MultiValueMap<String, String>> parametersConverter) Add (compose) the providedparametersConverterto the currentConverterused for converting theAbstractOAuth2AuthorizationGrantRequestinstance to aMultiValueMapused in the OAuth 2.0 Access Token Request body.- Parameters:
parametersConverter- theConverterto add (compose) to the currentConverterused for converting theAbstractOAuth2AuthorizationGrantRequestto aMultiValueMap
-
setParametersCustomizer
public void setParametersCustomizer(Consumer<org.springframework.util.MultiValueMap<String, String>> parametersCustomizer) Sets theConsumerused for customizing the OAuth 2.0 Access Token parameters, which allows for parameters to be added, overwritten or removed.- Parameters:
parametersCustomizer- theConsumerto customize the parameters
-