net.netheos.pcsapi.credentials
Class OAuth2Credentials

java.lang.Object
  extended by net.netheos.pcsapi.credentials.Credentials
      extended by net.netheos.pcsapi.credentials.OAuth2Credentials

public class OAuth2Credentials
extends Credentials

Credentials contains the OAuth informations.


Method Summary
 boolean equals(Object obj)
           
 String getAccessToken()
          Get the OAuth access token
 String getRefreshToken()
          Get the refresh token (used to renew the access token)
 String getTokenType()
          Get the access token type
 boolean hasExpired()
          Indicates if the access token has expired
 int hashCode()
           
 String toJson()
          Serialize the credentials in a JSON String.
 String toString()
           
 void update(org.json.JSONObject json)
          Update the credentials from a JSON request response.
 
Methods inherited from class net.netheos.pcsapi.credentials.Credentials
createFromJson
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hasExpired

public boolean hasExpired()
Indicates if the access token has expired

Returns:
true if expired, false otherwise

getAccessToken

public String getAccessToken()
Get the OAuth access token

Returns:
The token

getRefreshToken

public String getRefreshToken()
Get the refresh token (used to renew the access token)

Returns:
The token or null il the access token never expires

getTokenType

public String getTokenType()
Get the access token type

Returns:
The token type (ie. "Bearer")

update

public void update(org.json.JSONObject json)
Update the credentials from a JSON request response.

Parameters:
json - The JSON object containing the values to update

toJson

public String toJson()
Description copied from class: Credentials
Serialize the credentials in a JSON String.

Returns:
the json representation of credentials

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.