Class AbstractAuthHelper

  • Direct Known Subclasses:
    AuthTicketsHelper, FingerprintsHelper

    public abstract class AbstractAuthHelper
    extends java.lang.Object
    This super class is designed to lookup auth entries from file or memory.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getFileEntries​(java.io.File authFile)
      Get all the auth entries found in the specified auth file.
      protected static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getMemoryEntries​(java.util.Map<java.lang.String,​java.lang.String> authMap)
      Get all the auth entries found in the specified auth store in memory.
      protected static java.util.Map<java.lang.String,​java.lang.String> getMemoryEntry​(java.lang.String userName, java.lang.String serverAddress, java.util.Map<java.lang.String,​java.lang.String> authMap)
      Get the auth entry in the specified auth map that matches the specified user name and server address.
      protected static void saveFileEntry​(java.lang.String userName, java.lang.String serverAddress, java.lang.String authValue, java.io.File authFile, int lockTry, long lockDelay, long lockWait)
      Save the specified parameters as an entry into the specified auth file.
      protected static void saveMemoryEntry​(java.lang.String userName, java.lang.String serverAddress, java.lang.String authValue, java.util.Map<java.lang.String,​java.lang.String> authMap)
      Save the specified parameters as an entry into the specified auth map.
      • Methods inherited from class java.lang.Object

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

      • AbstractAuthHelper

        public AbstractAuthHelper()
    • Method Detail

      • getMemoryEntry

        protected static java.util.Map<java.lang.String,​java.lang.String> getMemoryEntry​(java.lang.String userName,
                                                                                               java.lang.String serverAddress,
                                                                                               java.util.Map<java.lang.String,​java.lang.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 java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getMemoryEntries​(java.util.Map<java.lang.String,​java.lang.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​(java.lang.String userName,
                                              java.lang.String serverAddress,
                                              java.lang.String authValue,
                                              java.util.Map<java.lang.String,​java.lang.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 java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getFileEntries​(java.io.File authFile)
                                                                                                        throws java.io.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:
        java.io.IOException - - io exception from reading auth file
      • saveFileEntry

        protected static void saveFileEntry​(java.lang.String userName,
                                            java.lang.String serverAddress,
                                            java.lang.String authValue,
                                            java.io.File authFile,
                                            int lockTry,
                                            long lockDelay,
                                            long lockWait)
                                     throws java.io.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:
        java.io.IOException - on error