Class OAuth2WebClientOptions


  • public class OAuth2WebClientOptions
    extends Object
    Author:
    Paulo Lopes
    • Field Detail

      • DEFAULT_RENEW_TOKEN_ON_FORBIDDEN

        public static final boolean DEFAULT_RENEW_TOKEN_ON_FORBIDDEN
        The default value of whether to perform a single token refresh if the response status code is 401 (Forbidden).
        See Also:
        Constant Field Values
      • DEFAULT_LEEWAY

        public static final int DEFAULT_LEEWAY
        The default leeway when validating token expiration times.
        See Also:
        Constant Field Values
    • Constructor Detail

      • OAuth2WebClientOptions

        public OAuth2WebClientOptions()
      • OAuth2WebClientOptions

        public OAuth2WebClientOptions​(OAuth2WebClientOptions other)
        Copy constructor.
        Parameters:
        other - the options to copy
      • OAuth2WebClientOptions

        public OAuth2WebClientOptions​(JsonObject json)
        Creates a new instance from JSON.
        Parameters:
        json - the JSON object
    • Method Detail

      • toJson

        public JsonObject toJson()
        Convert to JSON
        Returns:
        the JSON
      • isRenewTokenOnForbidden

        public boolean isRenewTokenOnForbidden()
        Weather to refresh or not the current user token if a forbidden http status response is received.
        Returns:
        default value is DEFAULT_RENEW_TOKEN_ON_FORBIDDEN
      • setRenewTokenOnForbidden

        public OAuth2WebClientOptions setRenewTokenOnForbidden​(boolean renewTokenOnForbidden)
        Set a default behavior on how to handle the first forbidden response. true to attempt a token refresh and replay the request. false to continue the request to the user handler/promise.
        Parameters:
        renewTokenOnForbidden - the desired intention.
        Returns:
        fluent self
      • getLeeway

        public int getLeeway()
        Weather to allow leeway while validating if a token is considered expired.
        Returns:
        default value is DEFAULT_LEEWAY
      • setLeeway

        public OAuth2WebClientOptions setLeeway​(int leeway)
        Set a default leeway in seconds to be considered while validating tokens for expiration.
        Parameters:
        leeway - the desired leeway in seconds
        Returns:
        fluent self