Class IssuedToken

java.lang.Object
eu.webtoolkit.jwt.auth.IssuedToken

public class IssuedToken
extends java.lang.Object
Token or authorization code that was issued to a relying party.

This class represents an access token. It is a value class that stores only the id and a reference to an AbstractUserDatabase to access its properties.

An object can point to a valid token, or be invalid. Invalid tokens are typically used as return value for database queries which did not match with an existing client.

See Also:
AbstractUserDatabase
  • Constructor Summary

    Constructors 
    Constructor Description
    IssuedToken()
    Default constructor.
    IssuedToken​(java.lang.String id, AbstractUserDatabase userDatabase)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    OAuthClient getAuthClient()
    Retrieves the client for which this token was issued.
    WDate getExpirationTime()
    Retrieves the time when the token expires.
    java.lang.String getId()
    Returns the user id.
    java.lang.String getPurpose()
    Retrieves the purpose of this token: authenication code, access token or refresh token.
    java.lang.String getRedirectUri()
    Retrieves the valid redirect uri of this token.
    java.lang.String getScope()
    Retrieves the scope of this token as a space-separated string.
    User getUser()
    Retrieves the user that is associated with this token.
    java.lang.String getValue()
    Retrieves the string value that represents this token, usually random characters.
    boolean isCheckValid()
    Returns whether the token is valid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IssuedToken

      public IssuedToken()
      Default constructor.

      Creates an invalid token.

      See Also:
      isCheckValid()
    • IssuedToken

      public IssuedToken​(java.lang.String id, AbstractUserDatabase userDatabase)
      Constructor.

      Creates a user with id id, and whose information is stored in the database.

  • Method Details

    • isCheckValid

      public boolean isCheckValid()
      Returns whether the token is valid.

      A invalid token is a sentinel value returned by methods that query the database but could not identify a matching user.

    • getId

      public java.lang.String getId()
      Returns the user id.

      This returns the id that uniquely identifies the token, and acts as a "primary key" to obtain other information for the token in the database.

      See Also:
      AbstractUserDatabase
    • getValue

      public java.lang.String getValue()
      Retrieves the string value that represents this token, usually random characters.
    • getExpirationTime

      public WDate getExpirationTime()
      Retrieves the time when the token expires.
    • getPurpose

      public java.lang.String getPurpose()
      Retrieves the purpose of this token: authenication code, access token or refresh token.
    • getScope

      public java.lang.String getScope()
      Retrieves the scope of this token as a space-separated string.
    • getRedirectUri

      public java.lang.String getRedirectUri()
      Retrieves the valid redirect uri of this token.
    • getUser

      public User getUser()
      Retrieves the user that is associated with this token.
    • getAuthClient

      public OAuthClient getAuthClient()
      Retrieves the client for which this token was issued.