Package com.nimbusds.oauth2.sdk
Class AccessTokenResponse
java.lang.Object
com.nimbusds.oauth2.sdk.TokenResponse
com.nimbusds.oauth2.sdk.AccessTokenResponse
- All Implemented Interfaces:
Message,Response,SuccessResponse
- Direct Known Subclasses:
OIDCTokenResponse
Access token response from the Token endpoint.
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:
- OAuth 2.0 (RFC 6749)
-
Constructor Summary
ConstructorsConstructorDescriptionAccessTokenResponse(Tokens tokens) Creates a new access token response.AccessTokenResponse(Tokens tokens, Map<String, Object> customParams) Creates a new access token response. -
Method Summary
Modifier and TypeMethodDescriptionReturns the custom parameters.Deprecated.Returns the tokens.booleanChecks if the response indicates success.static AccessTokenResponseparse(HTTPResponse httpResponse) Parses an access token response from the specified HTTP response.static AccessTokenResponseparse(net.minidev.json.JSONObject jsonObject) Parses an access token response from the specified JSON object.Returns the matching HTTP response.net.minidev.json.JSONObjectReturns a JSON object representation of this access token response.Methods inherited from class com.nimbusds.oauth2.sdk.TokenResponse
toErrorResponse, toSuccessResponse
-
Constructor Details
-
AccessTokenResponse
Creates a new access token response.- Parameters:
tokens- The tokens. Must not benull.
-
AccessTokenResponse
Creates a new access token response.- Parameters:
tokens- The tokens. Must not benull.customParams- Optional custom parameters,nullif none.
-
-
Method Details
-
indicatesSuccess
Description copied from interface:ResponseChecks if the response indicates success.- Specified by:
indicatesSuccessin interfaceResponse- Returns:
trueif the response indicates success, elsefalse.
-
getTokens
Returns the tokens.- Returns:
- The tokens.
-
getCustomParameters
Returns the custom parameters.- Returns:
- The custom parameters, as an unmodifiable map, empty map if none.
-
getCustomParams
Deprecated. -
toJSONObject
Returns a JSON object representation of this access token response.Example JSON object:
{ "access_token" : "SlAV32hkKG", "token_type" : "Bearer", "refresh_token" : "8xLOxBtZp8", "expires_in" : 3600 }- Returns:
- The JSON object.
-
toHTTPResponse
Description copied from interface:ResponseReturns the matching HTTP response.- Specified by:
toHTTPResponsein interfaceResponse- Returns:
- The HTTP response.
-
parse
public static AccessTokenResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException Parses an access token response from the specified JSON object.- Parameters:
jsonObject- The JSON object to parse. Must not benull.- Returns:
- The access token response.
- Throws:
ParseException- If the JSON object couldn't be parsed to an access token response.
-
parse
Parses an access token response from the specified HTTP response.- Parameters:
httpResponse- The HTTP response. Must not benull.- Returns:
- The access token response.
- Throws:
ParseException- If the HTTP response couldn't be parsed to an access token response.
-