Class TokenSpec

    • 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 be null.
        Returns:
        The token specification.
        Throws:
        com.nimbusds.oauth2.sdk.ParseException - If parsing failed.