|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.brickred.socialauth.util.OAuthConsumer
public class OAuthConsumer
It contains various method those are required for OAUTH
| Field Summary |
|---|
| Fields inherited from interface org.brickred.socialauth.util.Constants |
|---|
ACCESS_TOKEN_PARAMETER_NAME, CONTENT_ENCODING_HEADER, CURRENT_VERSION, ENCODING, EXPIRES, FACEBOOK, FOURSQUARE, GOOGLE, GZIP_CONTENT_ENCODING, HMACSHA1_SIGNATURE, HOTMAIL, HTTP_CONNECTION_TIMEOUT, LINKEDIN, MENDELEY, MYSPACE, OAUTH_ACCESS_TOKEN_URL, OAUTH_AUTHORIZATION_URL, OAUTH_CALLBACK, OAUTH_CALLBACK_CONFIRMED, OAUTH_CONSUMER_KEY, OAUTH_NONCE, OAUTH_PROBLEM, OAUTH_REQUEST_TOKEN_URL, OAUTH_SIGNATURE, OAUTH_SIGNATURE_METHOD, OAUTH_TIMESTAMP, OAUTH_TOKEN, OAUTH_TOKEN_SECRET, OAUTH_VERIFIER, OAUTH_VERSION, OOB, OPENID, PREFIX, PROXY_HOST, PROXY_PORT, RUNKEEPER, SALESFORCE, TWITTER, YAHOO, YAMMER |
| Constructor Summary | |
|---|---|
OAuthConsumer(OAuthConfig config)
|
|
| Method Summary | |
|---|---|
StringBuilder |
buildAuthUrl(String authUrl,
AccessGrant token,
String callbackUrl)
Builds the auth url to redirect the user to, based from the given token and callback url. |
String |
generateSignature(String signatureType,
String method,
String url,
Map<String,String> args,
AccessGrant token)
It returns a signature for signing OAuth request. |
AccessGrant |
getAccessToken(String accessTokenURL,
AccessGrant reqToken)
It obtains the access token. |
String |
getAuthHeaderValue(Map<String,String> params)
Generates Authorization header. |
OAuthConfig |
getConfig()
|
AccessGrant |
getRequestToken(String reqTokenURL,
String callbackURL)
It obtains the request token. |
Response |
httpGet(String reqURL,
Map<String,String> headerParams,
AccessGrant token)
Does an HTTP GET request. |
Response |
httpPost(String reqURL,
Map<String,String> params,
Map<String,String> headerParams,
String body,
AccessGrant token)
Does an HTTP POST request. |
Response |
httpPut(String reqURL,
Map<String,String> params,
Map<String,String> headerParams,
String body,
AccessGrant token)
Does an HTTP PUT request. |
Response |
httpPut(String reqURL,
Map<String,String> params,
Map<String,String> headerParams,
String body,
AccessGrant token,
boolean isHeaderRequired)
Does an HTTP PUT request. |
void |
putNonceAndTimestamp(Map<String,String> params)
Adds nonce and timestamp in given parameter map. |
Response |
uploadImage(String reqURL,
Map<String,String> paramsMap,
Map<String,String> headerParams,
InputStream inputStream,
String fileParamName,
String fileName,
String methodName,
AccessGrant token,
boolean isHeaderRequired)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OAuthConsumer(OAuthConfig config)
config - Configuration object which contains information of application
configuration| Method Detail |
|---|
public String generateSignature(String signatureType,
String method,
String url,
Map<String,String> args,
AccessGrant token)
throws Exception
signatureType - Type of signature. It can be HMAC-SHA1.method - Method type can be GET, POST or PUTurl - Requested URL for which generating signatureargs - Required arguments to generate signaturetoken - Token Object
Exception
public AccessGrant getRequestToken(String reqTokenURL,
String callbackURL)
throws Exception
reqTokenURL - Request Token URLcallbackURL - Callback URL
Exception
public AccessGrant getAccessToken(String accessTokenURL,
AccessGrant reqToken)
throws Exception
accessTokenURL - Access Token URLreqToken - Request Token
Exception
public Response httpGet(String reqURL,
Map<String,String> headerParams,
AccessGrant token)
throws Exception
reqURL - URL to send request to.headerParams - Header Parameterstoken - Token to pass in GET request
Exception
public Response httpPost(String reqURL,
Map<String,String> params,
Map<String,String> headerParams,
String body,
AccessGrant token)
throws Exception
reqURL - URL to send request to.params - Any additional parameters whose signature we want to compute.headerParams - Header Parametersbody - Request Bodytoken - Token to pass in POST request
Exception
public Response httpPut(String reqURL,
Map<String,String> params,
Map<String,String> headerParams,
String body,
AccessGrant token)
throws Exception
reqURL - URL to send request to.params - Any additional parameters whose signature we want to computeheaderParams - Header Parametersbody - Request Bodytoken - Token to pass in PUT request
Exception
public Response httpPut(String reqURL,
Map<String,String> params,
Map<String,String> headerParams,
String body,
AccessGrant token,
boolean isHeaderRequired)
throws Exception
reqURL - URL to send request to.params - Any additional parameters whose signature we want to computeheaderParams - Header Parametersbody - Request Bodytoken - Token to pass in PUT requestisHeaderRequired - True if header is required
Exceptionpublic void putNonceAndTimestamp(Map<String,String> params)
params -
public StringBuilder buildAuthUrl(String authUrl,
AccessGrant token,
String callbackUrl)
throws Exception
authUrl - token - callbackUrl - Callback URL
Exception
public String getAuthHeaderValue(Map<String,String> params)
throws Exception
params - Parameters to generate header value
Exceptionpublic OAuthConfig getConfig()
public Response uploadImage(String reqURL,
Map<String,String> paramsMap,
Map<String,String> headerParams,
InputStream inputStream,
String fileParamName,
String fileName,
String methodName,
AccessGrant token,
boolean isHeaderRequired)
throws Exception
reqURL - URL to send request to.paramsMap - Any additional parameters whose signature we want to compute.headerParams - Header ParametersinputStream - Input Stream of imagefileParamName - Image Filename parameter. It requires in some provider.fileName - Image file namemethodName - Method typetoken - Token to pass in PUT requestisHeaderRequired - True if header is required
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||