Interface IAuthToken

  • All Superinterfaces:
    com.helger.commons.id.IHasID<String>
    All Known Implementing Classes:
    AuthToken

    public interface IAuthToken
    extends com.helger.commons.id.IHasID<String>
    Interface for an auth token.
    Author:
    Philip Helger
    • Field Detail

      • EXPIRATION_SECONDS_INFINITE

        static final int EXPIRATION_SECONDS_INFINITE
        The value indicating, that a token never expires
        See Also:
        Constant Field Values
    • Method Detail

      • getID

        @Nonnull
        String getID()
        Specified by:
        getID in interface com.helger.commons.id.IHasID<String>
        Returns:
        The secret key token representing a session of a subject. Never null.
      • getCreationDate

        @Nonnull
        LocalDateTime getCreationDate()
        Returns:
        The date and time when the token was created. Never null.
      • getLastAccessDate

        @Nonnull
        LocalDateTime getLastAccessDate()
        Returns:
        The date and time when the token was last accessed. If the token was never accessed before, the creation date time is returned. Never null.
      • getExpirationSeconds

        @Nonnegative
        int getExpirationSeconds()
        Returns:
        The expiration seconds. Always ≥ 0. A value of 0 means no expiration.
        See Also:
        isExpirationPossible()
      • isExpirationPossible

        boolean isExpirationPossible()
        Check if this token can expire (expiration seconds > 0) or not (expiration seconds = 0).
        Returns:
        true if this token can expire, false otherwise.
        See Also:
        getExpirationSeconds()
      • getExpirationDate

        @Nullable
        LocalDateTime getExpirationDate()
        Get the date time when this token will expire. This date time changes every time the last access is updated.
        Returns:
        The expiration date and time or null if this token cannot expire.
        See Also:
        isExpirationPossible()
      • isExpired

        boolean isExpired()
        Check if the token is expired. Expired tokens are considered invalid.
        Returns:
        true if the token is already expired, false if the token is still valid.