Class AbstractAuthHelper

java.lang.Object
com.perforce.p4java.server.AbstractAuthHelper
Direct Known Subclasses:
AuthTicketsHelper, FingerprintsHelper

public abstract class AbstractAuthHelper extends Object
This super class is designed to lookup auth entries from file or memory.
  • Field Details

  • Constructor Details

    • AbstractAuthHelper

      public AbstractAuthHelper()
  • Method Details

    • getMemoryEntry

      protected static Map<String,String> getMemoryEntry(String userName, String serverAddress, Map<String,String> authMap)
      Get the auth entry in the specified auth map that matches the specified user name and server address. The user name be non-null and the server address must be non-null and be of the form server:port.
      Parameters:
      userName - userName
      serverAddress - serverAddress
      authMap - authMap
      Returns:
      - list of auth entries found in the specified auth map
    • getMemoryEntries

      protected static List<Map<String,String>> getMemoryEntries(Map<String,String> authMap)
      Get all the auth entries found in the specified auth store in memory.
      Parameters:
      authMap - authMap
      Returns:
      - list of auth entries found in the specified auth map
    • saveMemoryEntry

      protected static void saveMemoryEntry(String userName, String serverAddress, String authValue, Map<String,String> authMap)
      Save the specified parameters as an entry into the specified auth map. This method will add or replace the current entry for the user name and server address in the auth map. If the specified auth value is null then the current entry (if exits) in the specified map will be removed.
      Parameters:
      userName - - non-null user name
      serverAddress - - non-null server address
      authValue - - possibly null auth value
      authMap - - non-null auth map
    • getFileEntries

      protected static List<Map<String,String>> getFileEntries(File authFile) throws IOException
      Get all the auth entries found in the specified auth file.
      Parameters:
      authFile - authFile
      Returns:
      - list of auth entries found in the specified auth file
      Throws:
      IOException - - io exception from reading auth file
    • saveFileEntry

      protected static void saveFileEntry(String userName, String serverAddress, String authValue, File authFile, int lockTry, long lockDelay, long lockWait) throws IOException
      Save the specified parameters as an entry into the specified auth file. This method will replace the current entry for the user name and server address in the auth file. If a current entry is not found then the specified entry will be appended to the file. If the specified auth value is null then the current entry in the specified file will be removed if found.
      Parameters:
      userName - - non-null user name
      serverAddress - - non-null server address
      authValue - - possibly null auth value
      authFile - - non-null file
      lockTry - lockTry
      lockDelay - lockDelay
      lockWait - lockWait
      Throws:
      IOException - on error