Search in sources :

Example 11 with PasswordAdapter

use of com.sun.enterprise.security.store.PasswordAdapter in project Payara by payara.

the class RepositoryManager method validateMasterPassword.

/**
 * We validate the master password by trying to open the password alias
 * keystore. This means that the keystore must already exist.
 *
 * @param config
 * @param password
 * @throws RepositoryException
 */
public void validateMasterPassword(RepositoryConfig config, String password) throws RepositoryException {
    final PEFileLayout layout = getFileLayout(config);
    final File passwordAliases = layout.getPasswordAliasKeystore();
    try {
        // WBN July 2007
        // we are constructing this object ONLY to see if it throws
        // an Exception.  We do not use the object.
        new PasswordAdapter(passwordAliases.getAbsolutePath(), password.toCharArray());
    } catch (IOException ex) {
        throw new RepositoryException(_strMgr.getString("masterPasswordInvalid"));
    } catch (Exception ex) {
        throw new RepositoryException(_strMgr.getString("couldNotValidateMasterPassword", passwordAliases), ex);
    }
}
Also used : PEFileLayout(com.sun.enterprise.admin.servermgmt.pe.PEFileLayout) PasswordAdapter(com.sun.enterprise.security.store.PasswordAdapter) ZipFile(com.sun.enterprise.util.zip.ZipFile)

Aggregations

PasswordAdapter (com.sun.enterprise.security.store.PasswordAdapter)11 PEFileLayout (com.sun.enterprise.admin.servermgmt.pe.PEFileLayout)5 File (java.io.File)4 ZipFile (com.sun.enterprise.util.zip.ZipFile)3 IOException (java.io.IOException)2 CommandException (org.glassfish.api.admin.CommandException)2 RepositoryException (com.sun.enterprise.admin.servermgmt.RepositoryException)1 LoginException (com.sun.enterprise.security.auth.login.common.LoginException)1 MiniXmlParserException (com.sun.enterprise.universal.xml.MiniXmlParserException)1 UnknownHostException (java.net.UnknownHostException)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1 CommandValidationException (org.glassfish.api.admin.CommandValidationException)1 SSHLauncher (org.glassfish.cluster.ssh.launcher.SSHLauncher)1