Class PasswordAuthTokenAPIHandler.TokenInfo

    • 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
    • Constructor Detail

      • TokenInfo

        protected TokenInfo()
    • 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 last refreshPause ms.
        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 the refreshOffset).
        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 set lastUpdate.
        Parameters:
        tokenResponse - The TokenResponse.