|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.oauth2.sdk.TokenResponse com.nimbusds.oauth2.sdk.AccessTokenResponse
@Immutable public class AccessTokenResponse
Access token response from the Token endpoint. This class is immutable.
Example HTTP response:
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token" : "2YotnFZFEjr1zCsicMWpAA", "token_type" : "example", "expires_in" : 3600, "refresh_token" : "tGzv3JOkF0XG5Qx2TlKWIA", "example_parameter" : "example_value" }
Related specifications:
Constructor Summary | |
---|---|
AccessTokenResponse(AccessToken accessToken,
RefreshToken refreshToken)
Creates a new access token response. |
|
AccessTokenResponse(TokenPair tokenPair)
Creates a new access token response. |
Method Summary | |
---|---|
AccessToken |
getAccessToken()
Gets the access token. |
RefreshToken |
getRefreshToken()
Gets the optional refresh token. |
TokenPair |
getTokenPair()
Gets the access and refresh token pair. |
static AccessTokenResponse |
parse(HTTPResponse httpResponse)
Parses an access token response from the specified HTTP response. |
static AccessTokenResponse |
parse(net.minidev.json.JSONObject jsonObject)
Parses an access token response from the specified JSON object. |
HTTPResponse |
toHTTPResponse()
Returns the matching HTTP response. |
net.minidev.json.JSONObject |
toJSONObject()
Returns the JSON object representing this access token response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AccessTokenResponse(AccessToken accessToken, RefreshToken refreshToken)
accessToken
- The access token. Must not be null
.refreshToken
- Optional refresh token, null
if none.public AccessTokenResponse(TokenPair tokenPair)
tokenPair
- The access and refresh token pair. Must not be
null
.Method Detail |
---|
public AccessToken getAccessToken()
public RefreshToken getRefreshToken()
null
if none.public TokenPair getTokenPair()
null
.public net.minidev.json.JSONObject toJSONObject() throws SerializeException
Example JSON object:
{ "access_token" : "SlAV32hkKG", "token_type" : "Bearer", "refresh_token": "8xLOxBtZp8", "expires_in" : 3600 }
SerializeException
- If this access token response couldn't be
serialised to a JSON object.public HTTPResponse toHTTPResponse() throws SerializeException
Response
toHTTPResponse
in interface Response
SerializeException
- If the response message couldn't be
serialised to an HTTP response.public static AccessTokenResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject
- The JSON object to parse. Must not be null
.
ParseException
- If the JSON object couldn't be parsed to an
access token response.public static AccessTokenResponse parse(HTTPResponse httpResponse) throws ParseException
httpResponse
- The HTTP response. Must not be null
.
ParseException
- If the HTTP response couldn't be parsed to an
access token response.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |