Package com.nimbusds.openid.connect.sdk
Class OIDCTokenResponse
java.lang.Object
com.nimbusds.oauth2.sdk.TokenResponse
com.nimbusds.oauth2.sdk.AccessTokenResponse
com.nimbusds.openid.connect.sdk.OIDCTokenResponse
- All Implemented Interfaces:
Message,Response,SuccessResponse
OpenID Connect token response from the Token endpoint.
Example HTTP response:
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{
"access_token" : "SlAV32hkKG",
"token_type" : "Bearer",
"refresh_token" : "8xLOxBtZp8",
"expires_in" : 3600,
"id_token" : "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zZXJ2Z
XIuZXhhbXBsZS5jb20iLCJ1c2VyX2lkIjoiMjQ4Mjg5NzYxMDAxIiwiYXVkIjoic
zZCaGRSa3F0MyIsIm5vbmNlIjoibi0wUzZfV3pBMk1qIiwiZXhwIjoxMzExMjgxO
TcwLCJpYXQiOjEzMTEyODA5NzB9.RgXxzppVvn1EjUiV3LIZ19SyhdyREe_2jJjW
5EC8XjNuJfe7Dte8YxRXxssJ67N8MT9mvOI3HOHm4whNx5FCyemyCGyTLHODCeAr
_id029-4JP0KWySoan1jmT7vbGHhu89-l9MTdaEvu7pNZO7DHGwqnMWRe8hdG7jU
ES4w4ReQTygKwXVVOaiGoeUrv6cZdbyOnpGlRlHaiOsv_xMunNVJtn5dLz-0zZwV
ftKVpFuc1pGaVsyZsOtkT32E4c6MDHeCvIDlR5ESC0ct8BLvGJDB5954MjCR4_X2
GAEHonKw4NF8wTmUFvhslYXmjRNFs21Byjn3jNb7lSa3MBfVsw"
}
Related specifications:
- OpenID Connect Core 1.0, section 3.1.3.3.
- OAuth 2.0 (RFC 6749), sections 4.1.4 and 5.1.
-
Constructor Summary
ConstructorsConstructorDescriptionOIDCTokenResponse(OIDCTokens tokens) Creates a new OpenID Connect access token response.OIDCTokenResponse(OIDCTokens tokens, Map<String, Object> customParams) Creates a new OpenID Connect access token response. -
Method Summary
Modifier and TypeMethodDescriptionGets the OpenID Connect tokens.static OIDCTokenResponseparse(HTTPResponse httpResponse) Parses an OpenID Connect access token response from the specified HTTP response.static OIDCTokenResponseparse(net.minidev.json.JSONObject jsonObject) Parses an OpenID Connect token response from the specified JSON object.net.minidev.json.JSONObjectReturns a JSON object representation of this OpenID Connect token response.Casts this response to an access token response.Methods inherited from class com.nimbusds.oauth2.sdk.AccessTokenResponse
getCustomParameters, getCustomParams, getTokens, indicatesSuccess, toHTTPResponseMethods inherited from class com.nimbusds.oauth2.sdk.TokenResponse
toErrorResponse
-
Constructor Details
-
OIDCTokenResponse
Creates a new OpenID Connect access token response.- Parameters:
tokens- The OpenID Connect tokens. Must not benull.
-
OIDCTokenResponse
Creates a new OpenID Connect access token response.- Parameters:
tokens- The OpenID Connect tokens. Must not benull.customParams- Optional custom parameters,nullif none.
-
-
Method Details
-
getOIDCTokens
Gets the OpenID Connect tokens.- Returns:
- The OpenID Connect tokens.
-
toJSONObject
Returns a JSON object representation of this OpenID Connect token response.Example JSON object:
{ "access_token" : "SlAV32hkKG", "token_type" : "Bearer", "refresh_token": "8xLOxBtZp8", "expires_in" : 3600, "id_token" : "eyJ0 ... NiJ9.eyJ1c ... I6IjIifX0.DeWt4Qu ... ZXso" }- Overrides:
toJSONObjectin classAccessTokenResponse- Returns:
- The JSON object.
-
toSuccessResponse
Description copied from class:TokenResponseCasts this response to an access token response.- Overrides:
toSuccessResponsein classTokenResponse- Returns:
- The access token response.
-
parse
Parses an OpenID Connect token response from the specified JSON object.- Parameters:
jsonObject- The JSON object to parse. Must not benull.- Returns:
- The OpenID Connect token response.
- Throws:
ParseException- If the JSON object couldn't be parsed to an OpenID Connect token response.
-
parse
Parses an OpenID Connect access token response from the specified HTTP response.- Parameters:
httpResponse- The HTTP response. Must not benull.- Returns:
- The OpenID Connect access token response.
- Throws:
ParseException- If the HTTP response couldn't be parsed to an OpenID Connect access token response.
-