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

    Modifier and Type
    Method
    Description
    @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.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 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

      public long 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

      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.
    • toString

      public String toString()
      Overrides:
      toString in class 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 be null.
      Returns:
      The token specification.
      Throws:
      com.nimbusds.oauth2.sdk.ParseException - If parsing failed.