Class AccessTokenSpec

    • Field Summary

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

      Constructors 
      Constructor Description
      AccessTokenSpec()
      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.
    • Field Detail

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

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

      • 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

        public Optional<BooleangetEncryptSelfContained()
        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.