public class OAuthAuthorization extends Object implements Authorization, Serializable, OAuthSupport
| Constructor and Description |
|---|
OAuthAuthorization(Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
static String |
encodeParameters(List<HttpParameter> httpParams) |
static String |
encodeParameters(List<HttpParameter> httpParams,
String splitter,
boolean quot) |
boolean |
equals(Object o) |
List<HttpParameter> |
generateOAuthSignatureHttpParams(String method,
String url) |
String |
getAuthorizationHeader(HttpRequest req) |
AccessToken |
getOAuthAccessToken()
Returns an access token associated with this instance.
If no access token is associated with this instance, this will retrieve a new access token. |
AccessToken |
getOAuthAccessToken(RequestToken requestToken)
Retrieves an access token associated with the supplied request token and sets userId.
|
AccessToken |
getOAuthAccessToken(RequestToken requestToken,
String oauthVerifier)
Retrieves an access token associated with the supplied request token and sets userId.
|
AccessToken |
getOAuthAccessToken(String oauthVerifier)
Retrieves an access token.
|
AccessToken |
getOAuthAccessToken(String screenName,
String password)
Retrieves an access token associated with the supplied screen name and password using xAuth.
In order to get access acquire AccessToken using xAuth, you must apply by sending an email to api@twitter.com — all other applications will receive an HTTP 401 error. |
RequestToken |
getOAuthRequestToken()
Retrieves a request token
|
RequestToken |
getOAuthRequestToken(String callbackURL)
Retrieves a request token
|
RequestToken |
getOAuthRequestToken(String callbackURL,
String xAuthAccessType)
Retrieves a request token
|
RequestToken |
getOAuthRequestToken(String callbackURL,
String xAuthAccessType,
String xAuthMode)
Retrieves a request token
|
int |
hashCode() |
boolean |
isEnabled()
Returns true if authorization credentials are set.
|
void |
setOAuthAccessToken(AccessToken accessToken)
Sets the access token
|
void |
setOAuthConsumer(String consumerKey,
String consumerSecret)
sets the OAuth consumer key and consumer secret
|
void |
setOAuthRealm(String realm)
Sets the OAuth realm
|
String |
toString() |
public OAuthAuthorization(Configuration conf)
conf - configurationpublic String getAuthorizationHeader(HttpRequest req)
getAuthorizationHeader in interface Authorizationpublic boolean isEnabled()
isEnabled in interface Authorizationpublic RequestToken getOAuthRequestToken() throws TwitterException
OAuthSupportgetOAuthRequestToken in interface OAuthSupportTwitterException - when Twitter service or network is unavailablepublic RequestToken getOAuthRequestToken(String callbackURL) throws TwitterException
OAuthSupportgetOAuthRequestToken in interface OAuthSupportcallbackURL - callback URLTwitterException - when Twitter service or network is unavailablepublic RequestToken getOAuthRequestToken(String callbackURL, String xAuthAccessType) throws TwitterException
OAuthSupportgetOAuthRequestToken in interface OAuthSupportcallbackURL - callback URLxAuthAccessType - Overrides the access level an application requests to a users account. Supported values are read or write. This parameter is intended to allow a developer to register a read/write application but also request read only access when appropriate.TwitterException - when Twitter service or network is unavailablepublic RequestToken getOAuthRequestToken(String callbackURL, String xAuthAccessType, String xAuthMode) throws TwitterException
OAuthSupportgetOAuthRequestToken in interface OAuthSupportcallbackURL - callback URLxAuthAccessType - Overrides the access level an application requests to a users account. Supported values are read or write. This parameter is intended to allow a developer to register a read/write application but also request read only access when appropriate.xAuthMode - Set to reverse_auth to obtain a special request token to be used in the reverse auth process.TwitterException - when Twitter service or network is unavailablepublic AccessToken getOAuthAccessToken() throws TwitterException
OAuthSupportgetOAuthAccessToken in interface OAuthSupportTwitterException - when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(String oauthVerifier) throws TwitterException
OAuthSupportgetOAuthAccessToken in interface OAuthSupportoauthVerifier - OAuth verifier. AKA pin.TwitterException - when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(RequestToken requestToken) throws TwitterException
OAuthSupportgetOAuthAccessToken in interface OAuthSupportrequestToken - the request tokenTwitterException - when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(RequestToken requestToken, String oauthVerifier) throws TwitterException
OAuthSupportgetOAuthAccessToken in interface OAuthSupportrequestToken - the request tokenoauthVerifier - OAuth verifier. AKA pin.TwitterException - when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(String screenName, String password) throws TwitterException
OAuthSupportgetOAuthAccessToken in interface OAuthSupportscreenName - the screen namepassword - the passwordTwitterException - when Twitter service or network is unavailable, or the user has not authorizedpublic void setOAuthAccessToken(AccessToken accessToken)
OAuthSupportsetOAuthAccessToken in interface OAuthSupportaccessToken - accessTokenpublic void setOAuthRealm(String realm)
realm - OAuth realmpublic List<HttpParameter> generateOAuthSignatureHttpParams(String method, String url)
public static String encodeParameters(List<HttpParameter> httpParams)
httpParams - parameters to be encoded and concatenatedpublic static String encodeParameters(List<HttpParameter> httpParams, String splitter, boolean quot)
public void setOAuthConsumer(String consumerKey, String consumerSecret)
OAuthSupportsetOAuthConsumer in interface OAuthSupportconsumerKey - OAuth consumer keyconsumerSecret - OAuth consumer secretCopyright © 2018. All rights reserved.