Class FileSystemTokenStorage

java.lang.Object
org.codice.ddf.security.file.token.storage.FileSystemTokenStorage
All Implemented Interfaces:
org.codice.ddf.security.token.storage.api.TokenStorage

public class FileSystemTokenStorage extends Object implements org.codice.ddf.security.token.storage.api.TokenStorage
  • Constructor Details

    • FileSystemTokenStorage

      public FileSystemTokenStorage()
  • Method Details

    • getStateMap

      public Map<String,Map<String,Object>> getStateMap()
      Specified by:
      getStateMap in interface org.codice.ddf.security.token.storage.api.TokenStorage
      Returns:
      a map containing state UUIDs with their corresponding ID, source ID, discovery URL, client ID, and secret information. Clears out all the expired state information before returning the map.
    • create

      public 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.
      Specified by:
      create in interface org.codice.ddf.security.token.storage.api.TokenStorage
      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

      public org.codice.ddf.security.token.storage.api.TokenInformation read(String id)
      Reads tokens associated with the given ID
      Specified by:
      read in interface org.codice.ddf.security.token.storage.api.TokenStorage
      Parameters:
      id - the ID used to retrieve tokens
      Returns:
      a TokenInformation filled with tokens
    • read

      public org.codice.ddf.security.token.storage.api.TokenInformation.TokenEntry read(String id, String sourceId)
      Reads tokens associated with the given ID for the specified source
      Specified by:
      read in interface org.codice.ddf.security.token.storage.api.TokenStorage
      Parameters:
      id - the ID used to retrieve tokens
      sourceId - the source ID the tokens correspond to
      Returns:
      a TokenInformation.TokenEntry filled with tokens
    • isAvailable

      public boolean isAvailable(String id, String sourceId)
      Checks if tokens are available
      Specified by:
      isAvailable in interface org.codice.ddf.security.token.storage.api.TokenStorage
      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

      public int delete(String id)
      Removes tokens associated with the given ID
      Specified by:
      delete in interface org.codice.ddf.security.token.storage.api.TokenStorage
      Parameters:
      id - the ID associated with the tokens
      Returns:
      an HTTP status code
    • delete

      public int delete(String id, String sourceId)
      Removes tokens associated with the given ID for the specified source
      Specified by:
      delete in interface org.codice.ddf.security.token.storage.api.TokenStorage
      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
    • setBaseDirectory

      public void setBaseDirectory(String baseDirectory) throws IOException
      Throws:
      IOException