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, setUriTemplateHandlergetInterceptors, getRequestFactory, setInterceptorsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdelete, 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, putpublic 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.RestTemplatepublic OAuth2ProtectedResourceDetails getResource()
getResource in interface OAuth2RestOperationsprotected org.springframework.http.client.ClientHttpRequest createRequest(URI uri, org.springframework.http.HttpMethod method) throws IOException
createRequest in class org.springframework.http.client.support.HttpAccessorIOExceptionprotected <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.RestTemplateorg.springframework.web.client.RestClientExceptionpublic OAuth2AccessToken getAccessToken() throws UserRedirectRequiredException
getAccessToken in interface OAuth2RestOperationsUserRedirectRequiredExceptionpublic OAuth2ClientContext getOAuth2ClientContext()
getOAuth2ClientContext in interface OAuth2RestOperationsprotected OAuth2AccessToken acquireAccessToken(OAuth2ClientContext oauth2Context) throws UserRedirectRequiredException
UserRedirectRequiredExceptionprotected URI appendQueryParameter(URI uri, OAuth2AccessToken accessToken)
public void setAccessTokenProvider(AccessTokenProvider accessTokenProvider)
Copyright © 2019. All rights reserved.