Interface TokenService
public interface TokenService
Service for obtaining and refreshing
ClientToken.-
Method Summary
Modifier and TypeMethodDescriptionforceRefresh(ClientConfiguration config, ClientToken token) Refreshes provided token.booleanisRefreshNeeded(ClientToken token, Duration margin) Deprecated.this logic is no longer part of the public API.refreshIfNeeded(ClientConfiguration config, ClientToken token, Duration margin) Deprecated.
-
Method Details
-
forceRefresh
ClientToken forceRefresh(ClientConfiguration config, ClientToken token) throws TokenServiceException, IllegalArgumentException Refreshes provided token.- Parameters:
config- OAuth client config for the given tokentoken- original token- Returns:
- refreshed token
- Throws:
TokenServiceException- if there was an error while calling token endpointIllegalArgumentException- if token has no refresh token when it's required- See Also:
-
refreshIfNeeded
@Deprecated ClientToken refreshIfNeeded(ClientConfiguration config, ClientToken token, Duration margin) throws TokenServiceException Deprecated.Refreshes provided token if needed. For tokens without refresh token original token will be returned, depending on theGrantType- Parameters:
config- OAuth client config for the given tokentoken- original tokenmargin- max lifetime of the token that should be refreshed- Returns:
- refreshed token or original token (if refresh wasn't needed)
- Throws:
TokenServiceException- See Also:
-
isRefreshNeeded
Deprecated.this logic is no longer part of the public API. UseTokenHandler.getRefreshedToken(String, Duration)Provides check to see if refresh is needed. Fortokenwith no refresh token, this method will always returnfalse.- Parameters:
token- original tokenmargin- max lifetime of the token that should be refreshed- Returns:
- whether a refresh is required
-