Class EnvironmentTokenAPIHandler
- java.lang.Object
-
- co.arago.util.validation.RequiredFieldChecks
-
- co.arago.hiro.client.connection.AbstractAPIHandler
-
- co.arago.hiro.client.connection.AbstractClientAPIHandler
-
- co.arago.hiro.client.connection.AbstractVersionAPIHandler
-
- co.arago.hiro.client.connection.token.AbstractTokenAPIHandler
-
- co.arago.hiro.client.connection.token.EnvironmentTokenAPIHandler
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class EnvironmentTokenAPIHandler extends AbstractTokenAPIHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEnvironmentTokenAPIHandler.Builderstatic classEnvironmentTokenAPIHandler.Conf<T extends EnvironmentTokenAPIHandler.Conf<T>>-
Nested classes/interfaces inherited from class co.arago.hiro.client.connection.AbstractClientAPIHandler
AbstractClientAPIHandler.ProxySpec
-
Nested classes/interfaces inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
AbstractAPIHandler.GetterConf
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringtokenEnv-
Fields inherited from class co.arago.hiro.client.connection.AbstractClientAPIHandler
connectTimeout, externalHttpClient, followRedirects, httpClient, httpLogger, maxConnectionPool, proxy, sslContext, sslParameters
-
Fields inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
apiUrl, httpRequestTimeout, maxRetries, title, userAgent, version, webSocketUri
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEnvironmentTokenAPIHandler(EnvironmentTokenAPIHandler.Conf<?> builder)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.InstantexpiryInstant()Calculate the Instant after which the token should be refreshed.java.lang.StringgetToken()Return the current token from the System environment.booleanhasRefreshToken()Check for existence of a refresh token in the TokenAPIHandler.booleanhasToken()Check for existence of a token in the TokenAPIHandler.static EnvironmentTokenAPIHandler.Conf<?>newBuilder()voidrefreshToken()Refresh an invalid token.voidrevokeToken()Revoke a token-
Methods inherited from class co.arago.hiro.client.connection.token.AbstractTokenAPIHandler
addToHeaders, decodeToken
-
Methods inherited from class co.arago.hiro.client.connection.AbstractVersionAPIHandler
getApiUriOf, getVersionMap, requestVersionMap
-
Methods inherited from class co.arago.hiro.client.connection.AbstractClientAPIHandler
close, getHttpLogger, getOrBuildClient
-
Methods inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
addQueryAndFragment, buildApiURI, buildEndpointURI, buildURI, buildWebSocketURI, checkResponse, delete, executeAsyncWithStreamBody, executeAsyncWithStringBody, executeBinary, executeWithStreamBody, executeWithStringBody, get, getApiUrl, getBinary, getHttpRequestTimeout, getMaxRetries, getRequestBuilder, getUserAgent, getWebSocketUri, patch, patchBinary, post, postBinary, put, putBinary, send, sendAsync
-
-
-
-
Constructor Detail
-
EnvironmentTokenAPIHandler
protected EnvironmentTokenAPIHandler(EnvironmentTokenAPIHandler.Conf<?> builder)
Constructor.- Parameters:
builder- The builder to use.
-
-
Method Detail
-
newBuilder
public static EnvironmentTokenAPIHandler.Conf<?> newBuilder()
-
getToken
public java.lang.String getToken()
Return the current token from the System environment.- Specified by:
getTokenin classAbstractTokenAPIHandler- Returns:
- The current token.
-
refreshToken
public void refreshToken() throws HiroExceptionRefresh an invalid token.- Specified by:
refreshTokenin classAbstractTokenAPIHandler- Throws:
HiroException- On Hiro protocol / handling errors.
-
revokeToken
public void revokeToken() throws HiroExceptionRevoke a token- Specified by:
revokeTokenin classAbstractTokenAPIHandler- Throws:
HiroException- On Hiro protocol / handling errors.
-
hasToken
public boolean hasToken()
Check for existence of a token in the TokenAPIHandler.- Specified by:
hasTokenin classAbstractTokenAPIHandler- Returns:
- true if a token has been set or retrieved, false if the token is empty.
-
hasRefreshToken
public boolean hasRefreshToken()
Check for existence of a refresh token in the TokenAPIHandler.- Specified by:
hasRefreshTokenin classAbstractTokenAPIHandler- Returns:
- false
-
expiryInstant
public java.time.Instant expiryInstant()
Calculate the Instant after which the token should be refreshed.- Specified by:
expiryInstantin classAbstractTokenAPIHandler- Returns:
- The Instant after which the token shall be refreshed. null if token cannot be refreshed.
-
-