Class AsadminSecurityUtil

java.lang.Object
com.sun.enterprise.security.store.AsadminSecurityUtil

public class AsadminSecurityUtil extends Object
Various utility methods related to certificate-based security.

In particular, this class opens both the client-side keystore and the client-side truststore when either one is requested. This allows us to prompt only once for the master password (if necessary) without storing the password the user responds with which would be a security risk.

Author:
Tim Quinn (with portions refactored from elsewhere)
  • Field Details

    • GF_CLIENT_DIR

      public static final File GF_CLIENT_DIR
      Existing writable GlassFish client directory. It is used for caching data, locating SSH keys, etc.
  • Method Details

    • getGfClientSessionFile

      public static File getGfClientSessionFile(String host, int port)
      Parameters:
      host -
      port -
      Returns:
      $GF_CLIENT_DIR/cache/{host}_{port}/session
    • getInstance

      public static AsadminSecurityUtil getInstance(char[] commandLineMasterPassword, boolean isPromptable)
      Returns the usable instance, creating it if needed.
      Parameters:
      commandLineMasterPassword - password provided via the command line
      isPromptable - if the command requiring the object was run by a human who is present to respond to a prompt for the master password
      Returns:
      the usable instance
    • getInstance

      public static AsadminSecurityUtil getInstance(boolean isPromptable)
      Returns the usable instance, creating it if needed.
      Parameters:
      isPromptable - if the command requiring the object was run by a human who is present to respond to a prompt for the master password
      Returns:
    • getAsadminTruststorePassword

      public static char[] getAsadminTruststorePassword()
      Returns:
      the master password for the keystore and truststore, as set by the system property (defaulted if the property is not set).
    • getAsadminTruststore

      public AsadminTruststore getAsadminTruststore()
      Returns the opened AsadminTruststore object.
      Returns:
      the AsadminTruststore object
    • getAsadminKeystore

      public KeyStore getAsadminKeystore()