|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.security.oauth.consumer.CoreOAuthConsumerSupport
public class CoreOAuthConsumerSupport
Consumer-side support for OAuth. This support uses a URLConnection to interface with the
OAuth provider. A proxy will be selected, but it is assumed that the javax.net.ssl.TrustManagers
and other connection-related environment variables are already set up.
| Constructor Summary | |
|---|---|
CoreOAuthConsumerSupport()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
protected java.net.URL |
configureURLForProtectedAccess(java.net.URL url,
OAuthConsumerToken requestToken,
ProtectedResourceDetails details,
java.lang.String httpMethod)
Internal use of configuring the URL for protected access, the resource details already having been loaded. |
java.net.URL |
configureURLForProtectedAccess(java.net.URL url,
OAuthConsumerToken accessToken,
java.lang.String httpMethod)
Create a configured URL. |
OAuthConsumerToken |
getAccessToken(OAuthConsumerToken requestToken)
Get an access token for a protected resource. |
java.lang.String |
getAuthorizationHeader(ProtectedResourceDetails details,
OAuthConsumerToken accessToken,
java.net.URL url,
java.lang.String httpMethod)
Get the authorization header using the given access token that should be applied to the specified URL. |
int |
getConnectionTimeout()
The connection timeout (default 60 seconds). |
NonceFactory |
getNonceFactory()
The nonce factory. |
java.lang.String |
getOAuthQueryString(ProtectedResourceDetails details,
OAuthConsumerToken accessToken,
java.net.URL url,
java.lang.String httpMethod)
Get the query string that is to be used in the given request. |
ProtectedResourceDetailsService |
getProtectedResourceDetailsService()
The protected resource details service. |
java.net.ProxySelector |
getProxySelector()
The proxy selector to use. |
int |
getReadTimeout()
The read timeout (default 60 seconds). |
protected java.lang.String |
getSignatureBaseString(java.util.Map<java.lang.String,java.lang.String> oauthParams,
java.net.URL requestURL,
java.lang.String httpMethod)
Get the signature base string for the specified parameters. |
OAuthSignatureMethodFactory |
getSignatureFactory()
The signature factory to use. |
OAuthURLStreamHandlerFactory |
getStreamHandlerFactory()
The URL stream handler factory for connections to an OAuth resource. |
protected OAuthConsumerToken |
getTokenFromProvider(ProtectedResourceDetails details,
java.net.URL tokenURL,
OAuthConsumerToken requestToken)
Get the consumer token with the given parameters and URL. |
OAuthConsumerToken |
getUnauthorizedRequestToken(java.lang.String resourceId)
Get an unauthorized request token for a protected resource. |
protected java.util.Map<java.lang.String,java.lang.String> |
loadOAuthParameters(ProtectedResourceDetails details,
java.net.URL requestURL,
OAuthConsumerToken requestToken,
java.lang.String httpMethod)
Loads the OAuth parameters for the given resource at the given URL and the given token. |
protected java.net.HttpURLConnection |
openConnection(java.net.URL requestTokenURL)
Open a connection to the given URL. |
java.io.InputStream |
readProtectedResource(java.net.URL url,
OAuthConsumerToken accessToken,
java.lang.String httpMethod)
Read a protected resource from the given URL using the specified access token and HTTP method. |
protected java.io.InputStream |
readResource(ProtectedResourceDetails details,
java.net.URL url,
OAuthConsumerToken token,
java.lang.String httpMethod)
Read a resource. |
protected java.net.Proxy |
selectProxy(java.net.URL requestTokenURL)
Selects a proxy for the given URL. |
void |
setConnectionTimeout(int connectionTimeout)
The connection timeout. |
void |
setNonceFactory(NonceFactory nonceFactory)
The nonce factory. |
void |
setProtectedResourceDetailsService(ProtectedResourceDetailsService protectedResourceDetailsService)
The protected resource details service. |
void |
setProxySelector(java.net.ProxySelector proxySelector)
The proxy selector to use. |
void |
setReadTimeout(int readTimeout)
The read timeout. |
void |
setSignatureFactory(OAuthSignatureMethodFactory signatureFactory)
The signature factory to use. |
void |
setStreamHandlerFactory(OAuthURLStreamHandlerFactory streamHandlerFactory)
The URL stream handler factory for connections to an OAuth resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CoreOAuthConsumerSupport()
| Method Detail |
|---|
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exception
public OAuthConsumerToken getUnauthorizedRequestToken(java.lang.String resourceId)
throws OAuthRequestFailedException
OAuthConsumerSupport
getUnauthorizedRequestToken in interface OAuthConsumerSupportresourceId - The id of the protected resource for which to get a consumer token.
OAuthRequestFailedException
public OAuthConsumerToken getAccessToken(OAuthConsumerToken requestToken)
throws OAuthRequestFailedException
OAuthConsumerSupport
getAccessToken in interface OAuthConsumerSupportrequestToken - The (presumably authorized) request token.
OAuthRequestFailedException
public java.io.InputStream readProtectedResource(java.net.URL url,
OAuthConsumerToken accessToken,
java.lang.String httpMethod)
throws OAuthRequestFailedException
OAuthConsumerSupport
readProtectedResource in interface OAuthConsumerSupporturl - The URL.accessToken - The access token.httpMethod - The HTTP method.
OAuthRequestFailedException
protected java.io.InputStream readResource(ProtectedResourceDetails details,
java.net.URL url,
OAuthConsumerToken token,
java.lang.String httpMethod)
details - The details of the resource.url - The URL of the resource.token - The token.httpMethod - The http method.
public java.net.URL configureURLForProtectedAccess(java.net.URL url,
OAuthConsumerToken accessToken,
java.lang.String httpMethod)
throws OAuthRequestFailedException
configureURLForProtectedAccess in interface OAuthConsumerSupporturl - The base URL.accessToken - The access token.httpMethod - The HTTP method.
OAuthRequestFailedException
protected java.net.URL configureURLForProtectedAccess(java.net.URL url,
OAuthConsumerToken requestToken,
ProtectedResourceDetails details,
java.lang.String httpMethod)
url - The URL.requestToken - The request token.details - The details.httpMethod - The http method.
public java.lang.String getAuthorizationHeader(ProtectedResourceDetails details,
OAuthConsumerToken accessToken,
java.net.URL url,
java.lang.String httpMethod)
OAuthConsumerSupport
getAuthorizationHeader 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.
public java.lang.String getOAuthQueryString(ProtectedResourceDetails details,
OAuthConsumerToken accessToken,
java.net.URL url,
java.lang.String httpMethod)
OAuthConsumerSupport
getOAuthQueryString in interface OAuthConsumerSupportdetails - The resource details.accessToken - The access token.url - The URLhttpMethod - The http method.
protected OAuthConsumerToken getTokenFromProvider(ProtectedResourceDetails details,
java.net.URL tokenURL,
OAuthConsumerToken requestToken)
details - The resource details.tokenURL - The token URL.requestToken - The request token, or null if none.
protected java.util.Map<java.lang.String,java.lang.String> loadOAuthParameters(ProtectedResourceDetails details,
java.net.URL requestURL,
OAuthConsumerToken requestToken,
java.lang.String httpMethod)
details - The resource details.requestURL - The request URL.requestToken - The request token.httpMethod - The http method.
protected java.net.HttpURLConnection openConnection(java.net.URL requestTokenURL)
requestTokenURL - The request token URL.
protected java.net.Proxy selectProxy(java.net.URL requestTokenURL)
requestTokenURL - The URL
protected java.lang.String getSignatureBaseString(java.util.Map<java.lang.String,java.lang.String> oauthParams,
java.net.URL requestURL,
java.lang.String httpMethod)
oauthParams - The parameters.requestURL - The request URL.httpMethod - The http method.
public ProtectedResourceDetailsService getProtectedResourceDetailsService()
public void setProtectedResourceDetailsService(ProtectedResourceDetailsService protectedResourceDetailsService)
protectedResourceDetailsService - The protected resource details service.public OAuthURLStreamHandlerFactory getStreamHandlerFactory()
public void setStreamHandlerFactory(OAuthURLStreamHandlerFactory streamHandlerFactory)
streamHandlerFactory - The URL stream handler factory for connections to an OAuth resource.public NonceFactory getNonceFactory()
public void setNonceFactory(NonceFactory nonceFactory)
nonceFactory - The nonce factory.public OAuthSignatureMethodFactory getSignatureFactory()
public void setSignatureFactory(OAuthSignatureMethodFactory signatureFactory)
signatureFactory - The signature factory to use.public java.net.ProxySelector getProxySelector()
public void setProxySelector(java.net.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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||