|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.paypal.base.rest.OAuthTokenCredential
public final class OAuthTokenCredential
OAuthTokenCredential is used for generation of OAuth Token used by PayPal
REST API service. ClientID and ClientSecret are required by the class to
generate OAuth Token, the resulting token is of the form "Bearer xxxxxx". The
class has two constructors, one of it taking an additional configuration map
used for dynamic configuration. When using the constructor with out
configuration map the endpoint is fetched from the configuration that is used
during initialization. See PayPalResource for configuring the system.
When using a configuration map the class expects an entry by the name
"oauth.EndPoint" or "service.EndPoint" to retrieve the value of the endpoint
for the OAuth Service. If either are not present the configuration should
have a entry by the name "mode" with values sandbox or live wherein the
corresponding endpoints are default to PayPal endpoints.
| Constructor Summary | |
|---|---|
OAuthTokenCredential(String clientID,
String clientSecret)
|
|
OAuthTokenCredential(String clientID,
String clientSecret,
Map<String,String> configurationMap)
Configuration Constructor for dynamic configuration |
|
| Method Summary | |
|---|---|
long |
expiresIn()
Specifies how long this token can be used for placing API calls. |
String |
getAccessToken()
Computes Access Token by placing a call to OAuth server using ClientID and ClientSecret. |
String |
getAuthorizationHeader()
Computes Access Token by doing a Base64 encoding on the ClientID and ClientSecret. |
protected String |
getRequestPayload()
Returns the request payload for OAuth Service. |
static void |
setOAUTH_TOKEN_PATH(String oauthTokenPath)
Sets the URI path for the OAuth Token service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OAuthTokenCredential(String clientID,
String clientSecret)
clientID - Client ID for the OAuthclientSecret - Client Secret for OAuth
public OAuthTokenCredential(String clientID,
String clientSecret,
Map<String,String> configurationMap)
clientID - Client ID for the OAuthclientSecret - Client Secret for OAuthconfigurationMap - Dynamic configuration map which should have an entry for
'oauth.EndPoint' or 'service.EndPoint'. If either are not
present then there should be entry for 'mode' with values
sandbox/live, wherein PayPals endpoints are used.| Method Detail |
|---|
public static void setOAUTH_TOKEN_PATH(String oauthTokenPath)
oauthTokenPath - the URI part to set
public String getAccessToken()
throws PayPalRESTException
PayPalRESTException
public String getAuthorizationHeader()
throws PayPalRESTException
PayPalRESTExceptionpublic long expiresIn()
protected String getRequestPayload()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||