|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttwitter4j.auth.OAuthAuthorization
public class OAuthAuthorization
Constructor Summary | |
---|---|
OAuthAuthorization(Configuration conf)
|
Method Summary | |
---|---|
static String |
constructRequestURL(String url)
The Signature Base String includes the request absolute URL, tying the signature to a specific endpoint. |
static String |
encodeParameters(List<twitter4j.internal.http.HttpParameter> httpParams)
|
static String |
encodeParameters(List<twitter4j.internal.http.HttpParameter> httpParams,
String splitter,
boolean quot)
|
boolean |
equals(Object o)
|
List<twitter4j.internal.http.HttpParameter> |
generateOAuthSignatureHttpParams(String method,
String url)
|
String |
getAuthorizationHeader(twitter4j.internal.http.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 [email protected] — 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 |
int |
hashCode()
|
boolean |
isEnabled()
#{inheritDoc} |
static String |
normalizeAuthorizationHeaders(List<twitter4j.internal.http.HttpParameter> params)
|
static String |
normalizeRequestParameters(twitter4j.internal.http.HttpParameter[] params)
The request parameters are collected, sorted and concatenated into a normalized string: • Parameters in the OAuth HTTP Authorization header excluding the realm parameter. • Parameters in the HTTP POST request body (with a content-type of application/x-www-form-urlencoded). • HTTP GET parameters added to the URLs in the query part (as defined by [RFC3986] section 3). The oauth_signature parameter MUST be excluded. The parameters are normalized into a single string as follows: 1. |
static String |
normalizeRequestParameters(List<twitter4j.internal.http.HttpParameter> params)
|
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 |
static List<twitter4j.internal.http.HttpParameter> |
toParamList(twitter4j.internal.http.HttpParameter[] params)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OAuthAuthorization(Configuration conf)
conf
- configurationMethod Detail |
---|
public String getAuthorizationHeader(twitter4j.internal.http.HttpRequest req)
getAuthorizationHeader
in interface Authorization
public boolean isEnabled()
isEnabled
in interface Authorization
public RequestToken getOAuthRequestToken() throws TwitterException
getOAuthRequestToken
in interface OAuthSupport
TwitterException
- when Twitter service or network is unavailablepublic RequestToken getOAuthRequestToken(String callbackURL) throws TwitterException
getOAuthRequestToken
in interface OAuthSupport
callbackURL
- callback URL
TwitterException
- when Twitter service or network is unavailablepublic RequestToken getOAuthRequestToken(String callbackURL, String xAuthAccessType) throws TwitterException
getOAuthRequestToken
in interface OAuthSupport
callbackURL
- 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 AccessToken getOAuthAccessToken() throws TwitterException
getOAuthAccessToken
in interface OAuthSupport
TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(String oauthVerifier) throws TwitterException
getOAuthAccessToken
in interface OAuthSupport
oauthVerifier
- OAuth verifier. AKA pin.
TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(RequestToken requestToken) throws TwitterException
getOAuthAccessToken
in interface OAuthSupport
requestToken
- the request token
TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic AccessToken getOAuthAccessToken(RequestToken requestToken, String oauthVerifier) throws TwitterException
getOAuthAccessToken
in interface OAuthSupport
requestToken
- 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
getOAuthAccessToken
in interface OAuthSupport
screenName
- the screen namepassword
- the password
TwitterException
- when Twitter service or network is unavailable, or the user has not authorizedpublic void setOAuthAccessToken(AccessToken accessToken)
setOAuthAccessToken
in interface OAuthSupport
accessToken
- accessTokenpublic void setOAuthRealm(String realm)
realm
- OAuth realmpublic List<twitter4j.internal.http.HttpParameter> generateOAuthSignatureHttpParams(String method, String url)
public static String normalizeRequestParameters(twitter4j.internal.http.HttpParameter[] params)
params
- parameters to be normalized and concatenated
public static String normalizeRequestParameters(List<twitter4j.internal.http.HttpParameter> params)
public static String normalizeAuthorizationHeaders(List<twitter4j.internal.http.HttpParameter> params)
public static List<twitter4j.internal.http.HttpParameter> toParamList(twitter4j.internal.http.HttpParameter[] params)
public static String encodeParameters(List<twitter4j.internal.http.HttpParameter> httpParams)
httpParams
- parameters to be encoded and concatenated
public static String encodeParameters(List<twitter4j.internal.http.HttpParameter> httpParams, String splitter, boolean quot)
public static String constructRequestURL(String url)
url
- the url to be normalized
public void setOAuthConsumer(String consumerKey, String consumerSecret)
OAuthSupport
setOAuthConsumer
in interface OAuthSupport
consumerKey
- OAuth consumer keyconsumerSecret
- OAuth consumer secretpublic boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |