@Deprecated public class CoreOAuthConsumerSupport extends Object implements OAuthConsumerSupport, org.springframework.beans.factory.InitializingBean
URLConnection to interface with the
OAuth provider. A proxy will be selected, but it is assumed that the TrustManagers
and other connection-related environment variables are already set up.
| Modifier and Type | Class and Description |
|---|---|
static class |
CoreOAuthConsumerSupport.QueryParameterValue
Deprecated.
Marker class for an oauth parameter value that is a query parameter and should therefore not be included in the authorization header.
|
| Constructor and Description |
|---|
CoreOAuthConsumerSupport()
Deprecated.
|
CoreOAuthConsumerSupport(OAuthURLStreamHandlerFactory streamHandlerFactory)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Deprecated.
|
protected URL |
configureURLForProtectedAccess(URL url,
OAuthConsumerToken requestToken,
ProtectedResourceDetails details,
String httpMethod,
Map<String,String> additionalParameters)
Deprecated.
Internal use of configuring the URL for protected access, the resource details already having been loaded.
|
URL |
configureURLForProtectedAccess(URL url,
OAuthConsumerToken accessToken,
String httpMethod,
Map<String,String> additionalParameters)
Deprecated.
Create a configured URL.
|
protected String |
findValidHeaderValue(Set<CharSequence> paramValues)
Deprecated.
Finds a valid header value that is valid for the OAuth header.
|
OAuthConsumerToken |
getAccessToken(OAuthConsumerToken requestToken,
String verifier)
Deprecated.
Get an access token for a protected resource.
|
OAuthConsumerToken |
getAccessToken(ProtectedResourceDetails details,
OAuthConsumerToken requestToken,
String verifier)
Deprecated.
Get an access token for a protected resource.
|
String |
getAuthorizationHeader(ProtectedResourceDetails details,
OAuthConsumerToken accessToken,
URL url,
String httpMethod,
Map<String,String> additionalParameters)
Deprecated.
Get the authorization header using the given access token that should be applied to the specified URL.
|
int |
getConnectionTimeout()
Deprecated.
The connection timeout (default 60 seconds).
|
NonceFactory |
getNonceFactory()
Deprecated.
The nonce factory.
|
String |
getOAuthQueryString(ProtectedResourceDetails details,
OAuthConsumerToken accessToken,
URL url,
String httpMethod,
Map<String,String> additionalParameters)
Deprecated.
Get the query string that is to be used in the given request.
|
ProtectedResourceDetailsService |
getProtectedResourceDetailsService()
Deprecated.
The protected resource details service.
|
ProxySelector |
getProxySelector()
Deprecated.
The proxy selector to use.
|
int |
getReadTimeout()
Deprecated.
The read timeout (default 60 seconds).
|
protected String |
getSignatureBaseString(Map<String,Set<CharSequence>> oauthParams,
URL requestURL,
String httpMethod)
Deprecated.
Get the signature base string for the specified parameters.
|
OAuthSignatureMethodFactory |
getSignatureFactory()
Deprecated.
The signature factory to use.
|
OAuthURLStreamHandlerFactory |
getStreamHandlerFactory()
Deprecated.
The URL stream handler factory for connections to an OAuth resource.
|
protected OAuthConsumerToken |
getTokenFromProvider(ProtectedResourceDetails details,
URL tokenURL,
String httpMethod,
OAuthConsumerToken requestToken,
Map<String,String> additionalParameters)
Deprecated.
Get the consumer token with the given parameters and URL.
|
OAuthConsumerToken |
getUnauthorizedRequestToken(ProtectedResourceDetails details,
String callback)
Deprecated.
Get an unauthorized request token for a protected resource.
|
OAuthConsumerToken |
getUnauthorizedRequestToken(String resourceId,
String callback)
Deprecated.
Get an unauthorized request token for a protected resource.
|
protected Map<String,Set<CharSequence>> |
loadOAuthParameters(ProtectedResourceDetails details,
URL requestURL,
OAuthConsumerToken requestToken,
String httpMethod,
Map<String,String> additionalParameters)
Deprecated.
Loads the OAuth parameters for the given resource at the given URL and the given token.
|
protected HttpURLConnection |
openConnection(URL requestTokenURL)
Deprecated.
Open a connection to the given URL.
|
InputStream |
readProtectedResource(URL url,
OAuthConsumerToken accessToken,
String httpMethod)
Deprecated.
Read a protected resource from the given URL using the specified access token and HTTP method.
|
protected InputStream |
readResource(ProtectedResourceDetails details,
URL url,
String httpMethod,
OAuthConsumerToken token,
Map<String,String> additionalParameters,
Map<String,String> additionalRequestHeaders)
Deprecated.
Read a resource.
|
protected Proxy |
selectProxy(URL requestTokenURL)
Deprecated.
Selects a proxy for the given URL.
|
void |
setConnectionTimeout(int connectionTimeout)
Deprecated.
The connection timeout.
|
void |
setNonceFactory(NonceFactory nonceFactory)
Deprecated.
The nonce factory.
|
void |
setProtectedResourceDetailsService(ProtectedResourceDetailsService protectedResourceDetailsService)
Deprecated.
The protected resource details service.
|
void |
setProxySelector(ProxySelector proxySelector)
Deprecated.
The proxy selector to use.
|
void |
setReadTimeout(int readTimeout)
Deprecated.
The read timeout.
|
void |
setSignatureFactory(OAuthSignatureMethodFactory signatureFactory)
Deprecated.
The signature factory to use.
|
void |
setStreamHandlerFactory(OAuthURLStreamHandlerFactory streamHandlerFactory)
Deprecated.
The URL stream handler factory for connections to an OAuth resource.
|
protected String |
urlDecode(String token)
Deprecated.
URL-decode a token.
|
protected String |
urlEncode(String value)
Deprecated.
URL-encode a value.
|
public CoreOAuthConsumerSupport()
public CoreOAuthConsumerSupport(OAuthURLStreamHandlerFactory streamHandlerFactory)
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic OAuthConsumerToken getUnauthorizedRequestToken(String resourceId, String callback) throws OAuthRequestFailedException
OAuthConsumerSupportgetUnauthorizedRequestToken in interface OAuthConsumerSupportresourceId - The id of the protected resource for which to get a consumer token.callback - The callback URL.OAuthRequestFailedExceptionpublic OAuthConsumerToken getUnauthorizedRequestToken(ProtectedResourceDetails details, String callback) throws OAuthRequestFailedException
OAuthConsumerSupportgetUnauthorizedRequestToken in interface OAuthConsumerSupportdetails - The protected resource for which to get a consumer token.callback - The callback URL.OAuthRequestFailedExceptionpublic OAuthConsumerToken getAccessToken(OAuthConsumerToken requestToken, String verifier) throws OAuthRequestFailedException
OAuthConsumerSupportgetAccessToken in interface OAuthConsumerSupportrequestToken - The (presumably authorized) request token.verifier - The token verifier.OAuthRequestFailedExceptionpublic OAuthConsumerToken getAccessToken(ProtectedResourceDetails details, OAuthConsumerToken requestToken, String verifier)
OAuthConsumerSupportgetAccessToken in interface OAuthConsumerSupportdetails - The resource for which to get the access token.requestToken - The (presumably authorized) request token.verifier - The token verifier.public InputStream readProtectedResource(URL url, OAuthConsumerToken accessToken, String httpMethod) throws OAuthRequestFailedException
OAuthConsumerSupportreadProtectedResource in interface OAuthConsumerSupporturl - The URL.accessToken - The access token.httpMethod - The HTTP method.OAuthRequestFailedExceptionprotected InputStream readResource(ProtectedResourceDetails details, URL url, String httpMethod, OAuthConsumerToken token, Map<String,String> additionalParameters, Map<String,String> additionalRequestHeaders)
details - The details of the resource.url - The URL of the resource.httpMethod - The http method.token - The token.additionalParameters - Any additional request parameters.additionalRequestHeaders - Any additional request parameters.public URL configureURLForProtectedAccess(URL url, OAuthConsumerToken accessToken, String httpMethod, Map<String,String> additionalParameters) throws OAuthRequestFailedException
configureURLForProtectedAccess in interface OAuthConsumerSupporturl - The base URL.accessToken - The access token.httpMethod - The HTTP method.additionalParameters - Any additional request parameters.OAuthRequestFailedExceptionprotected URL configureURLForProtectedAccess(URL url, OAuthConsumerToken requestToken, ProtectedResourceDetails details, String httpMethod, Map<String,String> additionalParameters)
url - The URL.requestToken - The request token.details - The details.httpMethod - The http method.additionalParameters - Any additional request parameters.public String getAuthorizationHeader(ProtectedResourceDetails details, OAuthConsumerToken accessToken, URL url, String httpMethod, Map<String,String> additionalParameters)
OAuthConsumerSupportgetAuthorizationHeader in interface OAuthConsumerSupportdetails - The details of the protected resource.accessToken - The access token.url - The URL of the request.httpMethod - The http method for the protected resource.additionalParameters - Any additional request parameters.protected String findValidHeaderValue(Set<CharSequence> paramValues)
paramValues - The possible values for the oauth header.public String getOAuthQueryString(ProtectedResourceDetails details, OAuthConsumerToken accessToken, URL url, String httpMethod, Map<String,String> additionalParameters)
OAuthConsumerSupportgetOAuthQueryString in interface OAuthConsumerSupportdetails - The resource details.accessToken - The access token.url - The URLhttpMethod - The http method.additionalParameters - Any additional OAuth request parameters.protected OAuthConsumerToken getTokenFromProvider(ProtectedResourceDetails details, URL tokenURL, String httpMethod, OAuthConsumerToken requestToken, Map<String,String> additionalParameters)
details - The resource details.tokenURL - The token URL.httpMethod - The http method.requestToken - The request token, or null if none.additionalParameters - The additional request parameter.protected Map<String,Set<CharSequence>> loadOAuthParameters(ProtectedResourceDetails details, URL requestURL, OAuthConsumerToken requestToken, String httpMethod, Map<String,String> additionalParameters)
details - The resource details.requestURL - The request URL.requestToken - The request token.httpMethod - The http method.additionalParameters - Additional oauth parameters (outside of the core oauth spec).protected String urlEncode(String value)
value - The value to encode.protected String urlDecode(String token)
token - The token to URL-decode.protected HttpURLConnection openConnection(URL requestTokenURL)
requestTokenURL - The request token URL.protected Proxy selectProxy(URL requestTokenURL)
requestTokenURL - The URLprotected String getSignatureBaseString(Map<String,Set<CharSequence>> oauthParams, URL requestURL, String httpMethod)
oauthParams - The parameters (NOT oauth-encoded).requestURL - The request URL.httpMethod - The http method.public ProtectedResourceDetailsService getProtectedResourceDetailsService()
@Autowired public void setProtectedResourceDetailsService(ProtectedResourceDetailsService protectedResourceDetailsService)
protectedResourceDetailsService - The protected resource details service.public OAuthURLStreamHandlerFactory getStreamHandlerFactory()
@Autowired(required=false) public void setStreamHandlerFactory(OAuthURLStreamHandlerFactory streamHandlerFactory)
streamHandlerFactory - The URL stream handler factory for connections to an OAuth resource.public NonceFactory getNonceFactory()
@Autowired(required=false) public void setNonceFactory(NonceFactory nonceFactory)
nonceFactory - The nonce factory.public OAuthSignatureMethodFactory getSignatureFactory()
@Autowired(required=false) public void setSignatureFactory(OAuthSignatureMethodFactory signatureFactory)
signatureFactory - The signature factory to use.public ProxySelector getProxySelector()
@Autowired(required=false) public void setProxySelector(ProxySelector proxySelector)
proxySelector - The proxy selector to use.public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout - The connection timeout.public int getReadTimeout()
public void setReadTimeout(int readTimeout)
readTimeout - The read timeout.Copyright © 2020. All rights reserved.