com.nimbusds.openid.connect.sdk
Class OIDCAccessTokenResponse

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.TokenResponse
      extended by com.nimbusds.oauth2.sdk.AccessTokenResponse
          extended by com.nimbusds.openid.connect.sdk.OIDCAccessTokenResponse
All Implemented Interfaces:
Message, Response, SuccessResponse, OIDCTokenResponse

@Immutable
public final class OIDCAccessTokenResponse
extends AccessTokenResponse
implements OIDCTokenResponse

OpenID Connect access token response. This class is immutable.

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:

Author:
Vladimir Dzhuvinov

Constructor Summary
OIDCAccessTokenResponse(AccessToken accessToken, RefreshToken refreshToken, com.nimbusds.jwt.JWT idToken)
          Creates a new OpenID Connect access token response.
 
Method Summary
 com.nimbusds.jwt.JWT getIDToken()
          Gets the ID token.
static OIDCAccessTokenResponse parse(HTTPResponse httpResponse)
          Parses an OpenID Connect access token response from the specified HTTP response.
static OIDCAccessTokenResponse parse(net.minidev.json.JSONObject jsonObject)
          Parses an OpenID Connect access token response from the specified JSON object.
 net.minidev.json.JSONObject toJSONObject()
          Returns the JSON object representing this OpenID Connect access token response.
 
Methods inherited from class com.nimbusds.oauth2.sdk.AccessTokenResponse
getAccessToken, getRefreshToken, getTokenPair, toHTTPResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nimbusds.oauth2.sdk.Response
toHTTPResponse
 

Constructor Detail

OIDCAccessTokenResponse

public OIDCAccessTokenResponse(AccessToken accessToken,
                               RefreshToken refreshToken,
                               com.nimbusds.jwt.JWT idToken)
Creates a new OpenID Connect access token response.

Parameters:
accessToken - The access token. Must not be null.
refreshToken - Optional refresh token, null if none.
idToken - The ID token. Must be null if the request grant type was not GrantType.AUTHORIZATION_CODE.
Method Detail

getIDToken

public com.nimbusds.jwt.JWT getIDToken()
Gets the ID token.

Returns:
The ID token, null if none.

toJSONObject

public net.minidev.json.JSONObject toJSONObject()
                                         throws SerializeException
Returns the JSON object representing this OpenID Connect access 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:
toJSONObject in class AccessTokenResponse
Returns:
The JSON object.
Throws:
SerializeException - If this OpenID Connect access token response couldn't be serialised to a JSON object.

parse

public static OIDCAccessTokenResponse parse(net.minidev.json.JSONObject jsonObject)
                                     throws ParseException
Parses an OpenID Connect access token response from the specified JSON object.

Parameters:
jsonObject - The JSON object to parse. Must not be null.
Returns:
The OpenID Connect access token response.
Throws:
ParseException - If the JSON object couldn't be parsed to an OpenID Connect access token response.

parse

public static OIDCAccessTokenResponse parse(HTTPResponse httpResponse)
                                     throws ParseException
Parses an OpenID Connect access token response from the specified HTTP response.

Parameters:
httpResponse - The HTTP response. Must not be null.
Returns:
The OpenID Connect access token response.
Throws:
ParseException - If the HTTP response couldn't be parsed to an OpenID Connect access token response.


Copyright © 2013 NimbusDS. All Rights Reserved.