public class AuthorizationCodeAccessTokenProvider extends OAuth2AccessTokenSupport implements AccessTokenProvider
logger
Constructor and Description |
---|
AuthorizationCodeAccessTokenProvider() |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.web.client.ResponseExtractor<org.springframework.http.ResponseEntity<Void>> |
getAuthorizationResponseExtractor() |
protected UserApprovalRequiredException |
getUserApprovalSignal(AuthorizationCodeResourceDetails resource,
AccessTokenRequest request) |
OAuth2AccessToken |
obtainAccessToken(OAuth2ProtectedResourceDetails details,
AccessTokenRequest request)
Obtain a new access token for the specified protected resource.
|
String |
obtainAuthorizationCode(OAuth2ProtectedResourceDetails details,
AccessTokenRequest request) |
OAuth2AccessToken |
refreshAccessToken(OAuth2ProtectedResourceDetails resource,
OAuth2RefreshToken refreshToken,
AccessTokenRequest request) |
void |
setAuthorizationRequestEnhancer(RequestEnhancer authorizationRequestEnhancer)
A custom enhancer for the authorization request
|
void |
setScopePrefix(String scopePrefix)
Prefix for scope approval parameters.
|
void |
setStateKeyGenerator(StateKeyGenerator stateKeyGenerator) |
void |
setStateMandatory(boolean stateMandatory)
Flag to say that the use of state parameter is mandatory.
|
boolean |
supportsRefresh(OAuth2ProtectedResourceDetails resource) |
boolean |
supportsResource(OAuth2ProtectedResourceDetails resource)
Whether this provider supports the specified resource.
|
getAccessTokenUri, getHttpMethod, getRequestCallback, getResponseErrorHandler, getResponseExtractor, getRestTemplate, retrieveToken, setAuthenticationHandler, setInterceptors, setMessageConverters, setRequestFactory, setTokenRequestEnhancer
public AuthorizationCodeAccessTokenProvider()
public void setStateMandatory(boolean stateMandatory)
stateMandatory
- the flag value (default true)public void setAuthorizationRequestEnhancer(RequestEnhancer authorizationRequestEnhancer)
authorizationRequestEnhancer
- public void setScopePrefix(String scopePrefix)
scopePrefix
- public void setStateKeyGenerator(StateKeyGenerator stateKeyGenerator)
stateKeyGenerator
- the stateKeyGenerator to setpublic boolean supportsResource(OAuth2ProtectedResourceDetails resource)
AccessTokenProvider
supportsResource
in interface AccessTokenProvider
resource
- The resource.public boolean supportsRefresh(OAuth2ProtectedResourceDetails resource)
supportsRefresh
in interface AccessTokenProvider
resource
- The resource to checkpublic String obtainAuthorizationCode(OAuth2ProtectedResourceDetails details, AccessTokenRequest request) throws UserRedirectRequiredException, UserApprovalRequiredException, org.springframework.security.access.AccessDeniedException, OAuth2AccessDeniedException
UserRedirectRequiredException
UserApprovalRequiredException
org.springframework.security.access.AccessDeniedException
OAuth2AccessDeniedException
protected org.springframework.web.client.ResponseExtractor<org.springframework.http.ResponseEntity<Void>> getAuthorizationResponseExtractor()
public OAuth2AccessToken obtainAccessToken(OAuth2ProtectedResourceDetails details, AccessTokenRequest request) throws UserRedirectRequiredException, UserApprovalRequiredException, org.springframework.security.access.AccessDeniedException, OAuth2AccessDeniedException
AccessTokenProvider
obtainAccessToken
in interface AccessTokenProvider
details
- The protected resource for which this provider is to obtain an access token.request
- The parameters of the request giving context for the token details if any.UserRedirectRequiredException
- If the provider requires the current user to be redirected for
authorization.UserApprovalRequiredException
- If the provider is ready to issue a token but only if the user approvesorg.springframework.security.access.AccessDeniedException
- If the user denies access to the protected resource.OAuth2AccessDeniedException
public OAuth2AccessToken refreshAccessToken(OAuth2ProtectedResourceDetails resource, OAuth2RefreshToken refreshToken, AccessTokenRequest request) throws UserRedirectRequiredException, OAuth2AccessDeniedException
refreshAccessToken
in interface AccessTokenProvider
resource
- the resource for which a token refresh is requiredrefreshToken
- the refresh token to sendUserRedirectRequiredException
OAuth2AccessDeniedException
protected UserApprovalRequiredException getUserApprovalSignal(AuthorizationCodeResourceDetails resource, AccessTokenRequest request)
Copyright © 2019. All rights reserved.