Class OIDCTokens
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.token.Tokens
-
- com.nimbusds.openid.connect.sdk.token.OIDCTokens
-
public final class OIDCTokens extends Tokens
ID token, access token and optional refresh token.
-
-
Constructor Summary
Constructors Constructor Description OIDCTokens(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.nimbusds.jwt.JWT
getIDToken()
Gets the ID token.String
getIDTokenString()
Gets the ID token string.Set<String>
getParameterNames()
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
toJSONObject()
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 Detail
-
OIDCTokens
public OIDCTokens(com.nimbusds.jwt.JWT idToken, AccessToken accessToken, RefreshToken refreshToken)
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
public OIDCTokens(String idTokenString, AccessToken accessToken, RefreshToken refreshToken)
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
public OIDCTokens(AccessToken accessToken, RefreshToken refreshToken)
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 Detail
-
getIDToken
public com.nimbusds.jwt.JWT getIDToken()
Gets the ID token.- Returns:
- The ID token,
null
if none or if parsing to a JWT failed.
-
getIDTokenString
public String getIDTokenString()
Gets the ID token string.- Returns:
- The ID token string,
null
if none or if serialisation to a string failed.
-
getParameterNames
public Set<String> 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
public net.minidev.json.JSONObject 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
public static OIDCTokens parse(net.minidev.json.JSONObject jsonObject) throws ParseException
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.
-
-