public class OAuth3LeggedScheme extends Object implements AuthScheme, Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
OAuth3LeggedScheme.Token |
| Modifier and Type | Field and Description |
|---|---|
protected String |
consumerKey |
protected String |
consumerSecret |
| Modifier | Constructor and Description |
|---|---|
protected |
OAuth3LeggedScheme() |
|
OAuth3LeggedScheme(Provider provider,
String consumerKey,
String consumerSecret)
Creates and returns a new
OAuth3LeggedScheme configured with the
passed Provider, key, and secret. |
|
OAuth3LeggedScheme(Provider provider,
String consumerKey,
String consumerSecret,
HttpClient httpClient)
Creates and returns a new
OAuth3LeggedScheme configured with the
passed Provider, key, secret, and HttpClient. |
| Modifier and Type | Method and Description |
|---|---|
protected InputStream |
byteArrayToStream(byte[] bytes) |
OAuth3LeggedScheme.Token |
getAccessToken()
Returns the access token for which the original request token was
exchanged or null if the exchange hasn't occurred and no access token is
associated with the current instance.
|
String |
getAuthorizationUrl(String callbackUrl)
Sends a signed request to the associated provider to retrieve an initial
request token.
|
String |
getConsumerKey() |
String |
getConsumerSecret() |
protected net.oauth.http.HttpMessage |
getHttpMessage(net.oauth.OAuthMessage message,
net.oauth.OAuthAccessor accessor,
byte[] body,
boolean signBodyHash) |
net.oauth.http.HttpMessage |
getHttpMessage(Provider provider,
String method,
String url,
Map<String,String> headers,
byte[] body) |
net.oauth.http.HttpMessage |
getHttpMessage(Provider provider,
String method,
String url,
Map<String,String> headers,
byte[] body,
Collection<? extends Map.Entry> parameters) |
Provider |
getProvider()
Returns the associated provider.
|
OAuth3LeggedScheme.Token |
getRequestToken()
Returns the request token previously retrieved from the provider when
getAuthorizationUrl was executed or null if no request token is
associated with the current instance. |
void |
requestAccessToken(String oAuthToken)
Sends a signed request to the associated provider to exchange the passed
request token for an access token; if successfully exchanged, this token
can then be accessed using getAccessToken().
|
void |
requestAccessToken(String oAuthToken,
String oAuthVerifier)
Sends a signed request to the associated provider to exchange the passed
request token for an access token; if successfully exchanged, this token
can then be accessed using getAccessToken().
|
void |
setAccessToken(OAuth3LeggedScheme.Token token)
Associates the specified access token with the current instance.
|
void |
setRequestToken(OAuth3LeggedScheme.Token token)
Associates the specified request token with the current instance.
|
protected String consumerKey
protected String consumerSecret
protected OAuth3LeggedScheme()
public OAuth3LeggedScheme(Provider provider, String consumerKey, String consumerSecret)
OAuth3LeggedScheme configured with the
passed Provider, key, and secret.provider - OpenSocial provider that the current user should be
authenticated against; must have the three required
3-legged OAuth endpoints set (see GoogleProvider and
MySpaceProvider for reference)consumerKey - key provided by an OpenSocial container after
registering a new applicationconsumerSecret - secret provided by an OpenSocial container after
registering a new applicationpublic OAuth3LeggedScheme(Provider provider, String consumerKey, String consumerSecret, HttpClient httpClient)
OAuth3LeggedScheme configured with the
passed Provider, key, secret, and HttpClient.provider - OpenSocial provider that the current user should be
authenticated against; must have the three required
3-legged OAuth endpoints set (see GoogleProvider and
MySpaceProvider for reference)consumerKey - key provided by an OpenSocial container after
registering a new applicationconsumerSecret - secret provided by an OpenSocial container after
registering a new applicationhttpClient - HttpClient to use to execute the OAuth requestspublic net.oauth.http.HttpMessage getHttpMessage(Provider provider, String method, String url, Map<String,String> headers, byte[] body) throws RequestException, IOException
getHttpMessage in interface AuthSchemeRequestExceptionIOExceptionpublic net.oauth.http.HttpMessage getHttpMessage(Provider provider, String method, String url, Map<String,String> headers, byte[] body, Collection<? extends Map.Entry> parameters) throws RequestException, IOException
RequestExceptionIOExceptionpublic String getAuthorizationUrl(String callbackUrl) throws net.oauth.OAuthException, URISyntaxException, IOException
callbackUrl - URL to forward user to after successful sign-innet.oauth.OAuthExceptionURISyntaxExceptionIOExceptionpublic void requestAccessToken(String oAuthToken) throws net.oauth.OAuthException, URISyntaxException, IOException
oAuthToken - previously fetched request token to exchange for access
tokennet.oauth.OAuthExceptionURISyntaxExceptionIOExceptionpublic void requestAccessToken(String oAuthToken, String oAuthVerifier) throws net.oauth.OAuthException, URISyntaxException, IOException
oAuthToken - previously fetched request token to exchange for
access tokenoAuthVerifier - verification code returned by some providers, e.g.
Yahoonet.oauth.OAuthExceptionURISyntaxExceptionIOExceptionpublic Provider getProvider()
public OAuth3LeggedScheme.Token getRequestToken()
getAuthorizationUrl was executed or null if no request token is
associated with the current instance.getAuthorizationUrl(String)public OAuth3LeggedScheme.Token getAccessToken()
requestAccessToken(String)public void setRequestToken(OAuth3LeggedScheme.Token token)
token - request token to associatepublic void setAccessToken(OAuth3LeggedScheme.Token token)
token - access token to associatepublic String getConsumerKey()
public String getConsumerSecret()
protected InputStream byteArrayToStream(byte[] bytes)
protected net.oauth.http.HttpMessage getHttpMessage(net.oauth.OAuthMessage message,
net.oauth.OAuthAccessor accessor,
byte[] body,
boolean signBodyHash)
throws IOException,
RequestException
IOExceptionRequestExceptionCopyright © 2012. All Rights Reserved.