Class ProxyAuth


  • public class ProxyAuth
    extends java.lang.Object
    Mutual authentication between the proxy and a client. A client can be either the plug-in module of a Password Synchronizer or an administration tool. This class handles the authentication protocol from the proxy side.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CLIENT_PASSWORD_FILE_NAME
      The name of the password file of client (plugin or admin tool).
      static int PASSWORD_LENGTH
      The length of a password in bytes.
      static java.lang.String PROXY_PASSWORD_FILE_NAME
      The name of the password file of the proxy.
    • Constructor Summary

      Constructors 
      Constructor Description
      ProxyAuth()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean authenticate​(java.net.Socket socket, java.lang.String authFolder, PWSyncLog log)
      Perform mutual authentication between the proxy and a client.
      static void createPWDFile​(java.lang.String filePath, byte[] password)
      Create a password file using the specified password.
      • Methods inherited from class java.lang.Object

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

      • CLIENT_PASSWORD_FILE_NAME

        public static final java.lang.String CLIENT_PASSWORD_FILE_NAME
        The name of the password file of client (plugin or admin tool).
        See Also:
        Constant Field Values
      • PROXY_PASSWORD_FILE_NAME

        public static final java.lang.String PROXY_PASSWORD_FILE_NAME
        The name of the password file of the proxy.
        See Also:
        Constant Field Values
      • PASSWORD_LENGTH

        public static final int PASSWORD_LENGTH
        The length of a password in bytes.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProxyAuth

        public ProxyAuth()
    • Method Detail

      • createPWDFile

        public static void createPWDFile​(java.lang.String filePath,
                                         byte[] password)
                                  throws java.io.IOException
        Create a password file using the specified password.
        Parameters:
        filePath - The path of the password file that will be created.
        password - The password that will be written in the file.
        Throws:
        java.io.IOException - Error while writing the file.
      • authenticate

        public static boolean authenticate​(java.net.Socket socket,
                                           java.lang.String authFolder,
                                           PWSyncLog log)

        Perform mutual authentication between the proxy and a client. This method handles the proxy side of the protocol.

        The authentication protocol goes like this: First the proxy creates both password files. After that the proxy notifies the client that the authentication may begin. Then in turns the client and the each other's passwords over the connection: the client sends the proxy's password to the proxy, and the proxy sends the client's password to the client.

        Parameters:
        socket - A connection to the client.
        authFolder - Authentication folder.
        log - Logger.
        Returns:
        Whether the authentication succeeded.