org.springframework.security.oauth2.client
类 OAuth2RestTemplate

java.lang.Object
  继承者 org.springframework.http.client.support.HttpAccessor
      继承者 org.springframework.http.client.support.InterceptingHttpAccessor
          继承者 org.springframework.web.client.RestTemplate
              继承者 org.springframework.security.oauth2.client.OAuth2RestTemplate
所有已实现的接口:
OAuth2RestOperations, org.springframework.web.client.RestOperations

public class OAuth2RestTemplate
extends org.springframework.web.client.RestTemplate
implements OAuth2RestOperations

Rest template that is able to make OAuth2-authenticated REST requests with the credentials of the provided resource.

作者:
Ryan Heaton, Dave Syer

字段摘要
 
从类 org.springframework.http.client.support.HttpAccessor 继承的字段
logger
 
构造方法摘要
OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource)
           
OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context)
           
 
方法摘要
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()
           
 void setAccessTokenProvider(AccessTokenProvider accessTokenProvider)
           
 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).
 
从类 org.springframework.web.client.RestTemplate 继承的方法
delete, delete, delete, exchange, exchange, exchange, execute, execute, execute, getErrorHandler, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, getMessageConverters, headForHeaders, headForHeaders, headForHeaders, optionsForAllow, optionsForAllow, optionsForAllow, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put, setMessageConverters
 
从类 org.springframework.http.client.support.InterceptingHttpAccessor 继承的方法
getInterceptors, getRequestFactory, setInterceptors
 
从类 org.springframework.http.client.support.HttpAccessor 继承的方法
setRequestFactory
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 org.springframework.web.client.RestOperations 继承的方法
delete, delete, delete, exchange, exchange, exchange, execute, execute, execute, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, headForHeaders, headForHeaders, headForHeaders, optionsForAllow, optionsForAllow, optionsForAllow, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put
 

构造方法详细信息

OAuth2RestTemplate

public OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource)

OAuth2RestTemplate

public OAuth2RestTemplate(OAuth2ProtectedResourceDetails resource,
                          OAuth2ClientContext context)
方法详细信息

setRetryBadAccessTokens

public 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). Useful if the remote server doesn't recognize an old token which is stored in the client, but is happy to re-grant it.

参数:
retryBadAccessTokens - the flag to set (default true)

setErrorHandler

public void setErrorHandler(org.springframework.web.client.ResponseErrorHandler errorHandler)
覆盖:
org.springframework.web.client.RestTemplate 中的 setErrorHandler

createRequest

protected org.springframework.http.client.ClientHttpRequest createRequest(URI uri,
                                                                          org.springframework.http.HttpMethod method)
                                                                   throws IOException
覆盖:
org.springframework.http.client.support.HttpAccessor 中的 createRequest
抛出:
IOException

doExecute

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
覆盖:
org.springframework.web.client.RestTemplate 中的 doExecute
抛出:
org.springframework.web.client.RestClientException

getAccessToken

public OAuth2AccessToken getAccessToken()
                                 throws UserRedirectRequiredException
Acquire or renew an access token for the current context if necessary. This method will be called automatically when a request is executed (and the result is cached), but can also be called as a standalone method to pre-populate the token.

指定者:
接口 OAuth2RestOperations 中的 getAccessToken
返回:
an access token
抛出:
UserRedirectRequiredException

getOAuth2ClientContext

public OAuth2ClientContext getOAuth2ClientContext()
指定者:
接口 OAuth2RestOperations 中的 getOAuth2ClientContext
返回:
the context for this template

acquireAccessToken

protected OAuth2AccessToken acquireAccessToken(OAuth2ClientContext oauth2Context)
                                        throws UserRedirectRequiredException
抛出:
UserRedirectRequiredException

appendQueryParameter

protected URI appendQueryParameter(URI uri,
                                   OAuth2AccessToken accessToken)

setAccessTokenProvider

public void setAccessTokenProvider(AccessTokenProvider accessTokenProvider)


Copyright © 2013. All rights reserved.