Class AccessTokenSpec

java.lang.Object
com.nimbusds.openid.connect.provider.spi.grants.TokenSpec
com.nimbusds.openid.connect.provider.spi.grants.AccessTokenSpec

@Immutable public class AccessTokenSpec extends TokenSpec
Access token specification.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final AccessTokenSpec
    The default access token specification.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new default access token specification.
    AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
    Deprecated.
    AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt)
    Deprecated.
    AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
    Deprecated.
    AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, Optional<Boolean> encryptSelfContained, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
    Creates a new access token specification.
    AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, Optional<Boolean> encryptSelfContained)
    Creates a new access token specification.
    AccessTokenSpec(long lifetime, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
    Deprecated.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Deprecated.
    com.nimbusds.oauth2.sdk.token.TokenEncoding
    Returns the access token encoding.
    Returns the optional encryption preference for self-contained (JWT) access tokens.
    com.nimbusds.openid.connect.sdk.SubjectType
    Returns the access token subject type.
    parse(net.minidev.json.JSONObject jsonObject)
    Parses an access token specification from the specified JSON object.
    net.minidev.json.JSONObject
    Returns a JSON object representation of this token specification.

    Methods inherited from class com.nimbusds.openid.connect.provider.spi.grants.TokenSpec

    getAudience, getImpersonatedSubject, getLifetime, toString

    Methods inherited from class java.lang.Object

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

    • DEFAULT

      public static final AccessTokenSpec DEFAULT
      The default access token specification.
      • No explicit token lifetime is specified, to let the Connect2id server apply the default configured lifetime for access tokens.
      • No explicit token audience is specified.
      • No subject in impersonation and delegation cases is specified.
      • The token is self-contained (JWT-encoded) and the optional encryption preference is not set.
      • The access token subject type is public.
  • Constructor Details

    • AccessTokenSpec

      public AccessTokenSpec()
      Creates a new default access token specification. No explicit token lifetime is specified (to let the Connect2id server apply the default configured lifetime for access tokens). No explicit token audience is specified. No subject in impersonation and delegation cases is specified. The token is self-contained (JWT-encoded) and the optional encryption preference is not set. The access token subject type is public.
    • AccessTokenSpec

      @Deprecated public AccessTokenSpec(long lifetime, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
      Deprecated.
      Creates a new access token specification. No explicit token audience is specified. No subject in impersonation and delegation cases is specified. The access token subject type is public.
      Parameters:
      lifetime - The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).
      encoding - The access token encoding. Must not be null.
      encrypt - If true flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
    • AccessTokenSpec

      @Deprecated public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
      Deprecated.
      Creates a new access token specification. No subject in impersonation and delegation cases is specified. The access token subject type is public.
      Parameters:
      lifetime - The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).
      audList - Explicit list of audiences for the access token, null if not specified.
      encoding - The access token encoding. Must not be null.
      encrypt - If true flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
    • AccessTokenSpec

      @Deprecated public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt)
      Deprecated.
      Creates a new access token specification. The access token subject type is public.
      Parameters:
      lifetime - The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).
      audList - Explicit list of audiences for the access token, null if not specified.
      encoding - The access token encoding. Must not be null.
      impersonatedSubject - The subject in impersonation and delegation cases, null if not applicable.
      encrypt - If true flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
    • AccessTokenSpec

      @Deprecated public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
      Deprecated.
      Creates a new access token specification.
      Parameters:
      lifetime - The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).
      audList - Explicit list of audiences for the access token, null if not specified.
      encoding - The access token encoding. Must not be null.
      impersonatedSubject - The subject in impersonation and delegation cases, null if not applicable.
      encrypt - If true flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
      subjectType - The access token subject type.
    • AccessTokenSpec

      public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, Optional<Boolean> encryptSelfContained)
      Creates a new access token specification. No subject in impersonation and delegation cases is specified. The access token subject type is public.
      Parameters:
      lifetime - The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).
      audList - Explicit list of audiences for the access token, null if not specified.
      encoding - The access token encoding. Must not be null.
      encryptSelfContained - The optional encryption preference for self-contained (JWT) access tokens. Must not be null.
    • AccessTokenSpec

      public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, Optional<Boolean> encryptSelfContained, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
      Creates a new access token specification.
      Parameters:
      lifetime - The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).
      audList - Explicit list of audiences for the access token, null if not specified.
      encoding - The access token encoding. Must not be null.
      impersonatedSubject - The subject in impersonation and delegation cases, null if not applicable.
      encryptSelfContained - The optional encryption preference for self-contained (JWT) access tokens. Must not be null.
      subjectType - The access token subject type.
  • Method Details

    • getEncoding

      public com.nimbusds.oauth2.sdk.token.TokenEncoding getEncoding()
      Returns the access token encoding.
      Returns:
      The access token encoding.
    • encrypt

      @Deprecated public boolean encrypt()
      Deprecated.
      Returns the access token encryption flag.
      Returns:
      If true the access token is flagged for encryption. Applies to self-contained access tokens only.
    • getEncryptSelfContained

      Returns the optional encryption preference for self-contained (JWT) access tokens.
      Returns:
      The encryption preference.
    • getSubjectType

      public com.nimbusds.openid.connect.sdk.SubjectType getSubjectType()
      Returns the access token subject type.
      Returns:
      The subject type.
    • toJSONObject

      public net.minidev.json.JSONObject toJSONObject()
      Description copied from class: TokenSpec
      Returns a JSON object representation of this token specification.
      Overrides:
      toJSONObject in class TokenSpec
      Returns:
      The JSON object.
    • parse

      public static AccessTokenSpec parse(net.minidev.json.JSONObject jsonObject) throws com.nimbusds.oauth2.sdk.ParseException
      Parses an access token specification from the specified JSON object.
      Parameters:
      jsonObject - The JSON object. Must not be null.
      Returns:
      The access token specification.
      Throws:
      com.nimbusds.oauth2.sdk.ParseException - If parsing failed.