Class TokenSpec
- java.lang.Object
-
- com.nimbusds.openid.connect.provider.spi.grants.TokenSpec
-
- Direct Known Subclasses:
AccessTokenSpec
,OptionalTokenSpec
@Immutable public class TokenSpec extends Object
Base token specification.
-
-
Constructor Summary
Constructors Constructor Description TokenSpec(long lifetime)
Creates a new token specification.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable List<com.nimbusds.oauth2.sdk.id.Audience>
getAudience()
Returns the explicit list of audiences for the token.@Nullable com.nimbusds.oauth2.sdk.id.Subject
getImpersonatedSubject()
Returns the subject in impersonation and delegation cases.long
getLifetime()
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
toJSONObject()
Returns a JSON object representation of this token specification.String
toString()
-
-
-
Constructor Detail
-
TokenSpec
public TokenSpec(long lifetime)
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 implies not specified (to let the Connect2id server apply the default configured access token lifetime). For refresh tokens zero implies permanent (no expiration) and negative 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 implies not specified (to let the Connect2id server apply the default configured access token lifetime). For refresh tokens zero implies permanent (no expiration) and negative 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 Detail
-
getLifetime
public long getLifetime()
Returns the token lifetime.- Returns:
- The token lifetime, in seconds. For access tokens zero and negative implies not specified (to let the Connect2id server apply the default configured access token lifetime). For refresh tokens zero implies permanent (no expiration) and negative not specified (to let the Connect2id server apply the default configured refresh token lifetime).
-
getAudience
public @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> getAudience()
Returns the explicit list of audiences for the token.- Returns:
- The explicit list of audiences for the token,
null
if not specified.
-
getImpersonatedSubject
public @Nullable com.nimbusds.oauth2.sdk.id.Subject getImpersonatedSubject()
Returns the subject in impersonation and delegation cases.- Returns:
- The subject in impersonation and delegation cases,
null
if not applicable.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of this token specification.- Returns:
- The JSON object.
-
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.
-
-