Class DefaultClientCredentialsTokenResponseClient
- java.lang.Object
-
- org.springframework.security.oauth2.client.endpoint.DefaultClientCredentialsTokenResponseClient
-
- All Implemented Interfaces:
OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest>
public final class DefaultClientCredentialsTokenResponseClient extends java.lang.Object implements OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest>
The default implementation of anOAuth2AccessTokenResponseClient
for theclient_credentials
grant. This implementation uses aRestOperations
when requesting an access token credential at the Authorization Server's Token Endpoint.
-
-
Constructor Summary
Constructors Constructor Description DefaultClientCredentialsTokenResponseClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuth2AccessTokenResponse
getTokenResponse(OAuth2ClientCredentialsGrantRequest clientCredentialsGrantRequest)
Exchanges the authorization grant credential, provided in the authorization grant request, for an access token credential at the Authorization Server's Token Endpoint.void
setRequestEntityConverter(org.springframework.core.convert.converter.Converter<OAuth2ClientCredentialsGrantRequest,org.springframework.http.RequestEntity<?>> requestEntityConverter)
Sets theConverter
used for converting theOAuth2ClientCredentialsGrantRequest
to aRequestEntity
representation of the OAuth 2.0 Access Token Request.void
setRestOperations(org.springframework.web.client.RestOperations restOperations)
Sets theRestOperations
used when requesting the OAuth 2.0 Access Token Response.
-
-
-
Method Detail
-
getTokenResponse
public OAuth2AccessTokenResponse getTokenResponse(OAuth2ClientCredentialsGrantRequest clientCredentialsGrantRequest)
Description copied from interface:OAuth2AccessTokenResponseClient
Exchanges the authorization grant credential, provided in the authorization grant request, for an access token credential at the Authorization Server's Token Endpoint.- Specified by:
getTokenResponse
in interfaceOAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest>
- Parameters:
clientCredentialsGrantRequest
- the authorization grant request that contains the authorization grant credential- Returns:
- an
OAuth2AccessTokenResponse
that contains theaccess token
credential
-
setRequestEntityConverter
public void setRequestEntityConverter(org.springframework.core.convert.converter.Converter<OAuth2ClientCredentialsGrantRequest,org.springframework.http.RequestEntity<?>> requestEntityConverter)
Sets theConverter
used for converting theOAuth2ClientCredentialsGrantRequest
to aRequestEntity
representation of the OAuth 2.0 Access Token Request.- Parameters:
requestEntityConverter
- theConverter
used for converting to aRequestEntity
representation of the Access Token Request
-
setRestOperations
public void setRestOperations(org.springframework.web.client.RestOperations restOperations)
Sets theRestOperations
used when requesting the OAuth 2.0 Access Token Response.NOTE: At a minimum, the supplied
restOperations
must be configured with the following:HttpMessageConverter
's -FormHttpMessageConverter
andOAuth2AccessTokenResponseHttpMessageConverter
ResponseErrorHandler
-OAuth2ErrorResponseErrorHandler
- Parameters:
restOperations
- theRestOperations
used when requesting the Access Token Response
-
-