public interface OAuthService extends RestService
Modifier and Type | Method and Description |
---|---|
<T> T |
get(String uri,
Class<T> clazz,
boolean signed)
Perform a conditionally signed REST get command and return an object of the provided class
|
Token |
getAccessToken() |
Token |
getAccessToken(Token requestToken,
String verifier)
Returns the Oauth access token from request token and verifier
|
Token |
getAccessToken(Token requestToken,
Verifier verifier)
Retrieve the access token
|
String |
getAuthorizationUrl()
Returns the url to the OAuth service to ask an authorization to access the service.
|
JsonMapperService |
getJsonMapper() |
Token |
getRequestToken()
Returns an OAuth request token to initiate an OAuth connection.
|
OAuthSession |
getSession() |
String |
getVerifier()
Access to OAuth verifier
|
String |
getVerifierParamName()
Gives the OAuth verifier parameter name
|
String |
getVersion()
Gives the OAuth version of the provider
|
OAuthRequest |
requestFactory(Verb verb,
String uri)
Creates an OAuthRequest with the given Rest Verb and uri
|
Response |
sendSignedRequest(OAuthRequest request)
Signs and sends a simple request
|
Response |
sendSignedRequest(Verb verb,
String uri)
Send an OAuth request signed without any parameter
|
Response |
sendSignedRequest(Verb verb,
String uri,
Map<String,?> params)
Send an OAuth request signed with a list a parameter
|
Response |
sendSignedRequest(Verb verb,
String uri,
String key,
Object value)
Send an OAuth request signed with a single parameter
|
Response |
sendSignedXmlRequest(Verb verb,
String uri,
String payload)
Send an OAuth request signed with an XML Payload as content
|
void |
setAccessToken(String token,
String secret)
Initialize and set an OAuth access token from its and private keys
|
void |
setAccessToken(Token token)
Set the Access Token with for an OAuth access
|
void |
setVerifier(String verifierStr)
Used to initialize verifier code returned by OAuth service
|
void |
signRequest(Token accessToken,
OAuthRequest request)
Sign an OAuthRequest in order to make it valid for targeted service
|
delete, get, get, getSocialMediaName, isConnected, post, post, put
Token getAccessToken()
void setAccessToken(Token token)
token
- the token to setString getAuthorizationUrl()
String getVerifier()
void setVerifier(String verifierStr)
verifierStr
- verifier codeResponse sendSignedRequest(Verb verb, String uri)
verb
- a REST verburi
- the REST address of the requestResponse sendSignedRequest(Verb verb, String uri, Map<String,?> params)
verb
- a REST verburi
- the REST address of the requestparams
- a Map of key value parameters to send in the header of the requestResponse sendSignedRequest(Verb verb, String uri, String key, Object value)
verb
- a REST verburi
- the REST address of the requestkey
- name of the parametervalue
- value of the parametervoid setAccessToken(String token, String secret)
token
- keysecret
- secret keysResponse sendSignedXmlRequest(Verb verb, String uri, String payload)
verb
- the REST verb of the requesturi
- the url of the remote requestpayload
- the content of the XML payload to send to the serviceOAuthSession getSession()
Response sendSignedRequest(OAuthRequest request)
request
- the request to sign and send<T> T get(String uri, Class<T> clazz, boolean signed)
T
- generic type for returned objecturi
- a string with MessageFormat
placeholders (i.e. {0},
{1}) style for params. It's the uri to perform the REST get callclazz
- class of the returned objectsigned
- indicate if the request has to be signed or notString getVerifierParamName()
Token getRequestToken()
Token getAccessToken(Token requestToken, String verifier)
requestToken
- Request token sent to Social Mediaverifier
- Verifier returned by Social Media after sending the Request TokenToken getAccessToken(Token requestToken, Verifier verifier)
requestToken
- request token (obtained previously)verifier
- verifier codevoid signRequest(Token accessToken, OAuthRequest request)
accessToken
- the OAuth access token for the current OAuth sessionrequest
- the OAuth request to signString getVersion()
OAuthRequest requestFactory(Verb verb, String uri)
verb
- Rest verb to build the requesturi
- URI of the requestJsonMapperService getJsonMapper()
Copyright © 2012-2013. All Rights Reserved.