Class FixedTokenAPIHandler
- java.lang.Object
-
- co.arago.hiro.client.connection.AbstractAPIHandler
-
- co.arago.hiro.client.connection.AbstractVersionAPIHandler
-
- co.arago.hiro.client.connection.token.AbstractTokenAPIHandler
-
- co.arago.hiro.client.connection.token.FixedTokenAPIHandler
-
- All Implemented Interfaces:
TokenAPIHandler,java.lang.AutoCloseable
public class FixedTokenAPIHandler extends AbstractTokenAPIHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFixedTokenAPIHandler.Builderstatic classFixedTokenAPIHandler.Conf<T extends FixedTokenAPIHandler.Conf<T>>
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringtoken-
Fields inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
httpClientHandler, httpRequestTimeout, maxRetries, rootApiURI, title, userAgent, version, webSocketURI
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFixedTokenAPIHandler(FixedTokenAPIHandler.Conf<FixedTokenAPIHandler.Builder> 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.booleanhasRefreshToken()Check for existence of a refresh token in the TokenAPIHandler.booleanhasToken()Check for existence of a token in the TokenAPIHandler.static FixedTokenAPIHandler.Conf<?>newBuilder()voidrefreshToken()Refresh an invalid token.voidrevokeToken()Revoke a token-
Methods inherited from class co.arago.hiro.client.connection.token.AbstractTokenAPIHandler
addToHeaders, close, decodeToken
-
Methods inherited from class co.arago.hiro.client.connection.AbstractVersionAPIHandler
getApiURIOf, getVersionMap, requestVersionMap
-
Methods inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
addQueryFragmentAndNormalize, buildApiURI, buildEndpointURI, buildURI, buildWebSocketURI, checkResponse, delete, executeAsyncWithStreamBody, executeAsyncWithStringBody, executeBinary, executeWithStreamBody, executeWithStringBody, get, getBinary, getConf, getHttpLogger, getHttpRequestTimeout, getMaxRetries, getOrBuildClient, getRequestBuilder, getRootApiURI, getUserAgent, getWebSocketURI, patch, patchBinary, post, postBinary, put, putBinary, send, sendAsync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface co.arago.hiro.client.connection.token.TokenAPIHandler
buildWebSocketURI, checkResponse, getApiURIOf, getConf, getOrBuildClient, getRootApiURI, getUserAgent, getVersionMap
-
-
-
-
Constructor Detail
-
FixedTokenAPIHandler
protected FixedTokenAPIHandler(FixedTokenAPIHandler.Conf<FixedTokenAPIHandler.Builder> builder)
Constructor- Parameters:
builder- The builder to use.
-
-
Method Detail
-
newBuilder
public static FixedTokenAPIHandler.Conf<?> newBuilder()
-
getToken
public java.lang.String getToken()
Return the current token.- Returns:
- The current token.
-
refreshToken
public void refreshToken() throws HiroExceptionRefresh an invalid token.- Throws:
HiroException- On Hiro protocol / handling errors.
-
revokeToken
public void revokeToken() throws HiroExceptionRevoke a token- Throws:
HiroException- On Hiro protocol / handling errors.
-
hasToken
public boolean hasToken()
Check for existence of a token in the TokenAPIHandler.- 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.- Returns:
- false
-
expiryInstant
public java.time.Instant expiryInstant()
Calculate the Instant after which the token should be refreshed.- Returns:
- The Instant after which the token shall be refreshed. null if token cannot be refreshed.
-
-