Interface TokenStorage


public interface TokenStorage
Stores a user's or client's access token, refresh token, and the list of sources authorized to query.
  • Field Details

  • Method Details

    • getStateMap

      Map<String,Map<String,Object>> getStateMap()
      Returns:
      a map containing state UUIDs with their corresponding ID, source ID, discovery URL, client ID, and secret information.
    • create

      int create(String id, String sourceId, String accessToken, String refreshToken, String discoveryUrl)
      Stores a user's or client's access token. If it's a new user or client, creates a new entry. Otherwise, updates the existing data.
      Parameters:
      id - the ID used to store the tokens
      sourceId - the ID of the source the tokens are going to be used against
      accessToken - the access token
      refreshToken - the refresh token
      discoveryUrl - the metadata url of the OAuth provider protecting the source
      Returns:
      an HTTP status code
    • read

      Reads tokens associated with the given ID
      Parameters:
      id - the ID used to retrieve tokens
      Returns:
      a TokenInformation filled with tokens
    • read

      Reads tokens associated with the given ID for the specified source
      Parameters:
      id - the ID used to retrieve tokens
      sourceId - the source ID the tokens correspond to
      Returns:
      a TokenInformation.TokenEntry filled with tokens
    • isAvailable

      boolean isAvailable(String id, String sourceId)
      Checks if tokens are available
      Parameters:
      id - the ID used to check if tokens are available
      sourceId - the source ID the tokens correspond to
      Returns:
      true if the tokens for the given ID and source are available and false if they are not
    • delete

      int delete(String id)
      Removes tokens associated with the given ID
      Parameters:
      id - the ID associated with the tokens
      Returns:
      an HTTP status code
    • delete

      int delete(String id, String sourceId)
      Removes tokens associated with the given ID for the specified source
      Parameters:
      id - the ID associated with the tokens
      sourceId - the ID for the source the tokens are going to be used against
      Returns:
      an HTTP status code