public class OAuth2RestTemplate extends org.springframework.web.client.RestTemplate implements OAuth2RestOperations
Constructor and Description |
---|
OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource) |
OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource,
OAuth2ClientContext context) |
Modifier and Type | Method and Description |
---|---|
protected OAuth2AccessToken |
acquireAccessToken(OAuth2ClientContext oauth2Context) |
protected URI |
appendQueryParameter(URI uri,
OAuth2AccessToken accessToken) |
protected org.springframework.http.client.ClientHttpRequest |
createRequest(URI uri,
org.springframework.http.HttpMethod method) |
protected <T> T |
doExecute(URI url,
org.springframework.http.HttpMethod method,
org.springframework.web.client.RequestCallback requestCallback,
org.springframework.web.client.ResponseExtractor<T> responseExtractor) |
OAuth2AccessToken |
getAccessToken()
Acquire or renew an access token for the current context if necessary.
|
OAuth2ClientContext |
getOAuth2ClientContext() |
OAuth2ProtectedResourceDetails |
getResource() |
void |
setAccessTokenProvider(AccessTokenProvider accessTokenProvider) |
void |
setAuthenticator(OAuth2RequestAuthenticator authenticator)
Strategy for extracting an Authorization header from an access token and the request details.
|
void |
setErrorHandler(org.springframework.web.client.ResponseErrorHandler errorHandler) |
void |
setRetryBadAccessTokens(boolean retryBadAccessTokens)
Flag to determine whether a request that has an existing access token, and which then leads to an
AccessTokenRequiredException should be retried (immediately, once).
|
acceptHeaderRequestCallback, delete, delete, delete, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getErrorHandler, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, getMessageConverters, getUriTemplateHandler, handleResponse, headersExtractor, headForHeaders, headForHeaders, headForHeaders, httpEntityCallback, httpEntityCallback, optionsForAllow, optionsForAllow, optionsForAllow, patchForObject, patchForObject, patchForObject, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put, responseEntityExtractor, setDefaultUriVariables, setMessageConverters, setUriTemplateHandler
getInterceptors, getRequestFactory, setInterceptors
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
delete, delete, delete, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, headForHeaders, headForHeaders, headForHeaders, optionsForAllow, optionsForAllow, optionsForAllow, patchForObject, patchForObject, patchForObject, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put
public OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource)
public OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context)
public void setAuthenticator(OAuth2RequestAuthenticator authenticator)
authenticator
- the authenticator to usepublic void setRetryBadAccessTokens(boolean retryBadAccessTokens)
retryBadAccessTokens
- the flag to set (default true)public void setErrorHandler(org.springframework.web.client.ResponseErrorHandler errorHandler)
setErrorHandler
in class org.springframework.web.client.RestTemplate
public OAuth2ProtectedResourceDetails getResource()
getResource
in interface OAuth2RestOperations
protected org.springframework.http.client.ClientHttpRequest createRequest(URI uri, org.springframework.http.HttpMethod method) throws IOException
createRequest
in class org.springframework.http.client.support.HttpAccessor
IOException
protected <T> T doExecute(URI url, org.springframework.http.HttpMethod method, org.springframework.web.client.RequestCallback requestCallback, org.springframework.web.client.ResponseExtractor<T> responseExtractor) throws org.springframework.web.client.RestClientException
doExecute
in class org.springframework.web.client.RestTemplate
org.springframework.web.client.RestClientException
public OAuth2AccessToken getAccessToken() throws UserRedirectRequiredException
getAccessToken
in interface OAuth2RestOperations
UserRedirectRequiredException
public OAuth2ClientContext getOAuth2ClientContext()
getOAuth2ClientContext
in interface OAuth2RestOperations
protected OAuth2AccessToken acquireAccessToken(OAuth2ClientContext oauth2Context) throws UserRedirectRequiredException
UserRedirectRequiredException
protected URI appendQueryParameter(URI uri, OAuth2AccessToken accessToken)
public void setAccessTokenProvider(AccessTokenProvider accessTokenProvider)
Copyright © 2019. All rights reserved.