Class RetryingTokenAuthenticator
java.lang.Object
org.shakespeareframework.retrofit.oauth2.RetryingTokenAuthenticator
- All Implemented Interfaces:
okhttp3.Authenticator
- Direct Known Subclasses:
ResourceOwnerPasswordTokenAuthenticator
Authenticator
that will retry authentication at the #tokenServiceUrl for maxRetries
times.-
Nested Class Summary
Nested classes/interfaces inherited from interface okhttp3.Authenticator
okhttp3.Authenticator.Companion
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.shakespeareframework.retrofit.oauth2.Oauth2Api
Oauth2Api
instance to obtain a token.Fields inherited from interface okhttp3.Authenticator
Companion, JAVA_NET_AUTHENTICATOR, NONE
-
Constructor Summary
ModifierConstructorDescriptionprotected
RetryingTokenAuthenticator
(String tokenServiceUrl, int maxRetries) -
Method Summary
Modifier and TypeMethodDescriptionokhttp3.Request
authenticate
(okhttp3.Route route, okhttp3.Response response) protected abstract Oauth2Token
getToken()
-
Field Details
-
oauth2Api
protected final org.shakespeareframework.retrofit.oauth2.Oauth2Api oauth2ApiOauth2Api
instance to obtain a token.
-
-
Constructor Details
-
RetryingTokenAuthenticator
- Parameters:
tokenServiceUrl
- the URl of the token service.maxRetries
- maximum number of retries.
-
-
Method Details
-
authenticate
@Nullable public okhttp3.Request authenticate(@Nullable okhttp3.Route route, @Nonnull okhttp3.Response response) - Specified by:
authenticate
in interfaceokhttp3.Authenticator
-
getToken
- Returns:
- a valid token
-