Class OIDCTokens
java.lang.Object
com.nimbusds.oauth2.sdk.token.Tokens
com.nimbusds.openid.connect.sdk.token.OIDCTokens
ID token, access token and optional refresh token.
-
Constructor Summary
ConstructorsConstructorDescriptionOIDCTokens
(com.nimbusds.jwt.JWT idToken, AccessToken accessToken, RefreshToken refreshToken) Creates a new OpenID Connect tokens instance.OIDCTokens
(AccessToken accessToken, RefreshToken refreshToken) Creates a new OpenID Connect tokens instance without an ID token.OIDCTokens
(String idTokenString, AccessToken accessToken, RefreshToken refreshToken) Creates a new OpenID Connect tokens instance. -
Method Summary
Modifier and TypeMethodDescriptioncom.nimbusds.jwt.JWT
Gets the ID token.Gets the ID token string.Returns the token parameter names for the included tokens.static OIDCTokens
parse
(net.minidev.json.JSONObject jsonObject) Parses an OpenID Connect tokens instance from the specified JSON object.net.minidev.json.JSONObject
Returns the JSON object representation of this token pair.Methods inherited from class com.nimbusds.oauth2.sdk.token.Tokens
getAccessToken, getBearerAccessToken, getDPoPAccessToken, getMetadata, getRefreshToken, toOIDCTokens, toString
-
Constructor Details
-
OIDCTokens
Creates a new OpenID Connect tokens instance.- Parameters:
idToken
- The ID token. Must not benull
.accessToken
- The access token. Must not benull
.refreshToken
- The refresh token. If nonenull
.
-
OIDCTokens
Creates a new OpenID Connect tokens instance.- Parameters:
idTokenString
- The ID token string. Must not benull
.accessToken
- The access token. Must not benull
.refreshToken
- The refresh token. If nonenull
.
-
OIDCTokens
Creates a new OpenID Connect tokens instance without an ID token. Intended for token responses from a refresh token grant where the ID token is optional.- Parameters:
accessToken
- The access token. Must not benull
.refreshToken
- The refresh token. If nonenull
.
-
-
Method Details
-
getIDToken
Gets the ID token.- Returns:
- The ID token,
null
if none or if parsing to a JWT failed.
-
getIDTokenString
Gets the ID token string.- Returns:
- The ID token string,
null
if none or if serialisation to a string failed.
-
getParameterNames
Description copied from class:Tokens
Returns the token parameter names for the included tokens.- Overrides:
getParameterNames
in classTokens
- Returns:
- The token parameter names.
-
toJSONObject
Description copied from class:Tokens
Returns the JSON object representation of this token pair.Example JSON object:
{ "access_token" : "dZdt8BlltORMTz5U", "refresh_token" : "E87zjAoeNXaSoF1U" }
- Overrides:
toJSONObject
in classTokens
- Returns:
- The JSON object representation.
-
parse
Parses an OpenID Connect tokens instance from the specified JSON object.- Parameters:
jsonObject
- The JSON object to parse. Must not benull
.- Returns:
- The OpenID Connect tokens.
- Throws:
ParseException
- If the JSON object couldn't be parsed to an OpenID Connect tokens instance.
-