Class PasswordAuthTokenAPIHandler.TokenInfo
- java.lang.Object
-
- co.arago.hiro.client.model.HiroJsonMap
-
- co.arago.hiro.client.model.HiroMessage
-
- co.arago.hiro.client.model.token.TokenResponse
-
- co.arago.hiro.client.connection.token.PasswordAuthTokenAPIHandler.TokenInfo
-
- All Implemented Interfaces:
JsonMessage,java.io.Serializable
- Enclosing class:
- PasswordAuthTokenAPIHandler
protected static class PasswordAuthTokenAPIHandler.TokenInfo extends TokenResponse
Extends the TokenResponse with additional data and operations.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.time.InstantlastUpdateTimestamp of when the token has been fetchedprotected longrefreshOffsetms of offset for token expirylongrefreshPausems of time, where no refresh calls are sent to the backend to avoid request flooding-
Fields inherited from class co.arago.hiro.client.model.token.TokenResponse
application, expiresAt, identity, indentityId, refreshToken, token, type
-
Fields inherited from class co.arago.hiro.client.model.HiroMessage
hiroError
-
Fields inherited from class co.arago.hiro.client.model.HiroJsonMap
fieldsMap
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTokenInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.InstantexpiryInstant()Calculate the Instant after which the token should be refreshed (expiresAt minus therefreshOffset).voidparse(TokenResponse tokenResponse)Copy data from the response to me and setlastUpdate.booleantokenExpired()Check for token expirationbooleantokenFresh()Check, whether the token has been renewed within the lastrefreshPausems.-
Methods inherited from class co.arago.hiro.client.model.HiroMessage
catchError, getError, isError, setField
-
Methods inherited from class co.arago.hiro.client.model.HiroJsonMap
addFields, getMap, setFields, toMap
-
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.model.JsonMessage
toJsonString, toPrettyJsonString
-
-
-
-
Field Detail
-
refreshPause
public long refreshPause
ms of time, where no refresh calls are sent to the backend to avoid request flooding
-
lastUpdate
protected java.time.Instant lastUpdate
Timestamp of when the token has been fetched
-
refreshOffset
protected long refreshOffset
ms of offset for token expiry
-
-
Method Detail
-
tokenExpired
public boolean tokenExpired()
Check for token expiration- Returns:
- true if expired or no token is available, false otherwise.
-
tokenFresh
public boolean tokenFresh()
Check, whether the token has been renewed within the lastrefreshPausems.- Returns:
- true if within the timespan, false otherwise.
-
expiryInstant
public java.time.Instant expiryInstant()
Calculate the Instant after which the token should be refreshed (expiresAt minus therefreshOffset).- Returns:
- The Instant after which the token shall be refreshed. null if token cannot be refreshed.
-
parse
public void parse(TokenResponse tokenResponse)
Copy data from the response to me and setlastUpdate.- Parameters:
tokenResponse- The TokenResponse.
-
-