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 intDEFAULT_LEEWAYThe default leeway when validating token expiration times.static booleanDEFAULT_RENEW_TOKEN_ON_FORBIDDENThe 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 intgetLeeway()Weather to allow leeway while validating if a token is considered expired.booleanisRenewTokenOnForbidden()Weather to refresh or not the current user token if a forbidden http status response is received.OAuth2WebClientOptionssetLeeway(int leeway)Set a default leeway in seconds to be considered while validating tokens for expiration.OAuth2WebClientOptionssetRenewTokenOnForbidden(boolean renewTokenOnForbidden)Set a default behavior on how to handle the first forbidden response.JsonObjecttoJson()Convert to JSON
-
-
-
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.trueto attempt a token refresh and replay the request.falseto 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
-
-