public interface TokenInfo
The TokenInfo provides data associated with a login token and basic methods to verify the validity of token credentials at given point in time.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Map<String,String>
    Returns the private attributes stored with this info object.
    @NotNull Map<String,String>
    Returns the public attributes stored with this info object.
    @NotNull String
    Returns the login token.
    @NotNull String
    Returns the ID of the user associated with this token info object.
    boolean
    isExpired(long loginTime)
    Returns true if the token has already expired; false otherwise.
    boolean
    matches(@NotNull TokenCredentials tokenCredentials)
    Returns true if the specified credentials can be successfully validated against the information stored in this instance.
    boolean
    Tries to remove the login token and all related information.
    boolean
    resetExpiration(long loginTime)
    Resets the expiration time of the login token associated with the given TokenInfo.
  • Method Details

    • getUserId

      @NotNull @NotNull String getUserId()
      Returns the ID of the user associated with this token info object.
      Returns:
      the ID of the user.
    • getToken

      @NotNull @NotNull String getToken()
      Returns the login token.
      Returns:
      the login token.
    • isExpired

      boolean isExpired(long loginTime)
      Returns true if the token has already expired; false otherwise.
      Parameters:
      loginTime - The login time used to calculate the expiration status.
      Returns:
      true if the token has already expired; false otherwise.
    • resetExpiration

      boolean resetExpiration(long loginTime)
      Resets the expiration time of the login token associated with the given TokenInfo. Whether and when the expiration time of a given login token is being reset is an implementation detail. Implementations that don't allow for resetting the token's expiration time at all will always return false.
      Parameters:
      loginTime - The current login time.
      Returns:
      true if the expiration time has been reset, false otherwise.
    • remove

      boolean remove()
      Tries to remove the login token and all related information. This method returns true if the removal was successful.
      Returns:
      true if the removal was successful, false otherwise.
    • matches

      boolean matches(@NotNull @NotNull TokenCredentials tokenCredentials)
      Returns true if the specified credentials can be successfully validated against the information stored in this instance.
      Parameters:
      tokenCredentials - The credentials to validate.
      Returns:
      true if the specified credentials can be successfully validated against the information stored in this instance; false otherwise.
    • getPrivateAttributes

      @NotNull @NotNull Map<String,String> getPrivateAttributes()
      Returns the private attributes stored with this info object.
      Returns:
      the private attributes stored with this info object.
    • getPublicAttributes

      @NotNull @NotNull Map<String,String> getPublicAttributes()
      Returns the public attributes stored with this info object.
      Returns:
      the public attributes stored with this info object.