Class TokenValidationResult.Builder

    • Constructor Detail

      • Builder

        public Builder​(boolean active)
        Creates a new builder object.
        Parameters:
        active - true if the token is active, false if not. Per RFC 7662, a value of true for this property indicates that the given token was issued by the Token Validator's associated authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g. after its issuance time and before its expiration time).
      • Builder

        public Builder​(java.lang.String accessToken,
                       boolean active)
        Creates a new builder object.
        Parameters:
        accessToken - the actual access token, as received from the authorization server. May be null.
        active - true if the token is active, false if not. Per RFC 7662, a value of true for this property indicates that the given token was issued by the Token Validator's associated authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g. after its issuance time and before its expiration time).
    • Method Detail

      • setActive

        public TokenValidationResult.Builder setActive​(boolean active)
        Set the active field of the token validation result.
        Parameters:
        active - true if the token is active, false if not. Per RFC 7662, a value of true for this property indicates that the given token was issued by the Token Validator's associated authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g. after its issuance time and before its expiration time).
        Returns:
        this.
      • setScope

        public TokenValidationResult.Builder setScope​(java.util.Set<java.lang.String> scope)
        Set the optional scope field of the token validation result.
        Parameters:
        scope - A list of strings representing the scopes associated with this token.
        Returns:
        this.
      • setClientId

        public TokenValidationResult.Builder setClientId​(java.lang.String clientId)
        Set the optional clientId field of the token validation result.
        Parameters:
        clientId - Client identifier for the OAuth 2.0 client that requested this token.
        Returns:
        this.
      • setUsername

        public TokenValidationResult.Builder setUsername​(java.lang.String username)
        Set the optional username field of the token validation result.
        Parameters:
        username - Human-readable identifier for the resource owner who authorized this token.
        Returns:
        this.
      • setTokenType

        public TokenValidationResult.Builder setTokenType​(java.lang.String tokenType)
        Set the optional tokenType field of the token validation result.
        Parameters:
        tokenType - Type of the token as defined in section 5.1 of OAuth 2.0 [RFC6749].
        Returns:
        this.
      • setExpirationTime

        public TokenValidationResult.Builder setExpirationTime​(long expirationTime,
                                                               java.util.concurrent.TimeUnit timeUnit)
        Set the optional expirationTime field of the token validation result.
        Parameters:
        expirationTime - Integer timestamp, measured in the number of time units since January 1 1970 UTC, indicating when this token will expire.
        timeUnit - the time units of the specified expiration time.
        Returns:
        this.
      • setIssuedAt

        public TokenValidationResult.Builder setIssuedAt​(long issuedAt,
                                                         java.util.concurrent.TimeUnit timeUnit)
        Set the optional issuedAt field of the token validation result.
        Parameters:
        issuedAt - Integer timestamp, measured in the number of time units since January 1 1970 UTC, indicating when this token was originally issued.
        timeUnit - the time units of the specified issuedAt time.
        Returns:
        this.
      • setNotUsedBefore

        public TokenValidationResult.Builder setNotUsedBefore​(long notUsedBefore,
                                                              java.util.concurrent.TimeUnit timeUnit)
        Set the optional notUsedBefore field of the token validation result.
        Parameters:
        notUsedBefore - Integer timestamp, measured in the number of time units since January 1 1970 UTC, indicating when this token is not to be used before.
        timeUnit - the time units of the specified notUsedBefore time.
        Returns:
        this.
      • setTokenSubject

        public TokenValidationResult.Builder setTokenSubject​(java.lang.String tokenSubject)
        Set the optional subjectToken field of the token validation result.
        Parameters:
        tokenSubject - Subject of the token, as defined in JWT [RFC7519]. This value should contain the subject ID as known to the external authorization server rather than the local server.
        Returns:
        this.
      • setAudience

        public TokenValidationResult.Builder setAudience​(java.util.Set<java.lang.String> audience)
        Set the optional audience field of the token validation result.
        Parameters:
        audience - Service-specific identifiers representing the intended audience(s) for this token, as defined in JWT [RFC7519].
        Returns:
        this.
      • setTokenIdentifier

        public TokenValidationResult.Builder setTokenIdentifier​(java.lang.String tokenIdentifier)
        Set the optional tokenIdentifier field of the token validation result.
        Parameters:
        tokenIdentifier - Unique string identifier for the token, as defined in section 4.1.7 of JWT [RFC7519].
        Returns:
        this.
      • setAdditionalProperties

        public TokenValidationResult.Builder setAdditionalProperties​(java.util.Map<java.lang.String,​java.lang.Object> properties)
        Set the optional additionalProperties field of the token validation result.
        Parameters:
        properties - Map of property names to values, containing any extension values implemented by the AccessTokenValidator.
        Returns:
        this.
      • build

        public TokenValidationResult build()
        Builds a new TokenValidationResult from the parameters previously supplied to the builder.
        Returns:
        a new TokenValidationResult.