Class TokenSpec
java.lang.Object
com.nimbusds.openid.connect.provider.spi.grants.TokenSpec
- Direct Known Subclasses:
AccessTokenSpec
,OptionalTokenSpec
Base token specification.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable List<com.nimbusds.oauth2.sdk.id.Audience>
Returns the explicit list of audiences for the token.@Nullable com.nimbusds.oauth2.sdk.id.Subject
Returns the subject in impersonation and delegation cases.long
Returns the token lifetime.static TokenSpec
parse
(net.minidev.json.JSONObject jsonObject) Parses a token specification from the specified JSON object.net.minidev.json.JSONObject
Returns a JSON object representation of this token specification.toString()
-
Constructor Details
-
TokenSpec
Creates a new token specification. No explicit token audience is specified. No subject in impersonation and delegation cases is specified.- Parameters:
lifetime
- The token lifetime, in seconds. For access tokens zero and negative means not specified (to let the Connect2id server apply the default configured access token lifetime). For refresh tokens zero means no lifetime limit and negative means not specified (to let the Connect2id server apply the default configured refresh token lifetime).
-
TokenSpec
public TokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject) Creates a new token specification.- Parameters:
lifetime
- The token lifetime, in seconds. For access tokens zero and negative means not specified (to let the Connect2id server apply the default configured access token lifetime). For refresh tokens zero means no lifetime limit and negative means not specified (to let the Connect2id server apply the default configured refresh token lifetime).audList
- Explicit list of audiences for the token,null
if not specified.impersonatedSubject
- The subject in impersonation and delegation cases,null
if not applicable.
-
-
Method Details
-
getLifetime
Returns the token lifetime.- Returns:
- The token lifetime, in seconds. For access tokens zero and negative means not specified (to let the Connect2id server apply the default configured access token lifetime). For refresh tokens zero means no lifetime limit and negative means not specified (to let the Connect2id server apply the default configured refresh token lifetime).
-
getAudience
Returns the explicit list of audiences for the token.- Returns:
- The explicit list of audiences for the token,
null
if not specified.
-
getImpersonatedSubject
Returns the subject in impersonation and delegation cases.- Returns:
- The subject in impersonation and delegation cases,
null
if not applicable.
-
toJSONObject
Returns a JSON object representation of this token specification.- Returns:
- The JSON object.
-
toString
-
parse
public static TokenSpec parse(net.minidev.json.JSONObject jsonObject) throws com.nimbusds.oauth2.sdk.ParseException Parses a token specification from the specified JSON object.- Parameters:
jsonObject
- The JSON object. Must not benull
.- Returns:
- The token specification.
- Throws:
com.nimbusds.oauth2.sdk.ParseException
- If parsing failed.
-