Package io.vertx.ext.web.client

## Class OAuth2WebClientOptions

- java.lang.Object
- - io.vertx.ext.web.client.OAuth2WebClientOptions

-     public class OAuth2WebClientOptions
      extends Object

  Author:
    Paulo Lopes

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_LEEWAY` | The default leeway when validating token expiration times.
    `static 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).

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OAuth2WebClientOptions()` |
    `OAuth2WebClientOptions​(JsonObject json)` | Creates a new instance from JSON.
    `OAuth2WebClientOptions​(OAuth2WebClientOptions other)` | Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getLeeway()` | Weather to allow leeway while validating if a token is considered expired.
    `boolean` | `isRenewTokenOnForbidden()` | Weather to refresh or not the current user token if a forbidden http status response is received.
    `OAuth2WebClientOptions` | `setLeeway​(int leeway)` | Set a default leeway in seconds to be considered while validating tokens for expiration.
    `OAuth2WebClientOptions` | `setRenewTokenOnForbidden​(boolean renewTokenOnForbidden)` | Set a default behavior on how to handle the first forbidden response.
    `JsonObject` | `toJson()` | Convert to JSON

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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