Examples of PasswordAdapter


Examples of com.sun.enterprise.security.store.PasswordAdapter

        mgr.validateMasterPassword(config);
        if (adminPwdAlias!=null) {
            String domainsRoot =  (String)config.get(DomainConfig.K_DOMAINS_ROOT);
            String keyStoreFile= domainsRoot+ File.separator + domainName +  File.separator + "config" + File.separator +
                      PasswordAdapter.PASSWORD_ALIAS_KEYSTORE;
            PasswordAdapter p =
                new PasswordAdapter(keyStoreFile, masterPassword.toCharArray());
            String clearPwd = p.getPasswordForAlias(adminPwdAlias);
            config.put(DomainConfig.K_PASSWORD, clearPwd);
            mgr.validateAdminUserAndPassword(config);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

                 java.util.HashMap extrapasswords = getExtraPasswords( extraPasswordOptions);
                 if (getOption(S1ASCommand.PASSWORDFILE) != null && extrapasswords.size()>0) {
                     final String masterPassword = (String)config.get( DomainConfig.K_MASTER_PASSWORD);
                     String domainsRoot = (String)config.get( DomainConfig.K_DOMAINS_ROOT);
                     String keyStoreFile= domainsRoot + File.separator + domainName +  File.separator + "config" + File.separator + PasswordAdapter.PASSWORD_ALIAS_KEYSTORE;
                     PasswordAdapter p = null;
                     try {
                         p = new PasswordAdapter(keyStoreFile, masterPassword.toCharArray());
                     } catch (Exception ex) { }

                     for (java.util.Iterator it = extrapasswords.entrySet().iterator(); it.hasNext(); ) {
                          java.util.Map.Entry entry = (java.util.Map.Entry)it.next();
                          String optionname = (String) entry.getKey();
                          String password = (String) entry.getValue();
                          String aliasname = RelativePathResolver.getAlias(password);
                          if (aliasname != null && p != null) {
                              try {
                                   final String clearpwd = p.getPasswordForAlias( aliasname);
                                   if (clearpwd != null)  {
                                       entry.setValue(clearpwd);
                                   }
                              } catch (Exception ex) {}
                          }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

                    try {
                        if (pwdAdapter==null) {
                            //The masterPassword in the IdentityManager is available only through
                            //a running DAS, server instance, or node agent.
                            String masterPassword = IdentityManager.getMasterPassword();
                            pwdAdapter = new PasswordAdapter(masterPassword.toCharArray());
                        }
                        result = pwdAdapter.getPasswordForAlias(aliasName);
                        //System.err.println("alias password " + result);
                    } catch (Exception ex) {                       
                        getLogger().log(Level.WARNING, "enterprise_util.path_resolver_alias_exception",
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

        } catch (final Exception e) { //underlying code is unsafe!
            return (at);
        }
        final String          an = RelativePathResolver.getAlias(at);
        final String          sp = IdentityManager.getMasterPassword();
        final PasswordAdapter pa = new PasswordAdapter(sp.toCharArray()); // use default password store
        final boolean     exists = pa.aliasExists(an);
        if (!exists) {
            final StringManager lsm = StringManager.getManager(RelativePathResolver.class);
            final String msg = lsm.getString("no_such_alias", an, at);
            throw new IllegalArgumentException(msg);
        }
        final String real = pa.getPasswordForAlias(an);
        return ( real );
    }   
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

        }

        String alias = ((SecretKeyCallback.AliasRequest)secretKeyCallback.getRequest()).getAlias();
        if (alias != null) {
            try {
                PasswordAdapter passwordAdapter = null;
                if (Switch.getSwitch().getContainerType() ==
                        Switch.APPCLIENT_CONTAINER) {
                    passwordAdapter = new PasswordAdapter(
                        System.getProperty(CLIENT_SECRET_KEYSTORE),
                        System.getProperty(CLIENT_SECRET_KEYSTORE_PASSWORD,
                            DEFAULT_CLIENT_SECRET_KEYSTORE_PASSWORD).toCharArray());
                } else {
                    passwordAdapter = new PasswordAdapter(
                        IdentityManager.getMasterPassword().toCharArray());
                }

                secretKeyCallback.setKey(
                    passwordAdapter.getPasswordSecretKeyForAlias(alias));
            } catch(Exception e) {
                if (_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE,
                    "JMAC: In SecretKeyCallback Processor: "+
                    " Error reading key ! for alias "+alias, e);
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

    protected final String readFromMasterPasswordFile() {
        File mpf = getMasterPasswordFile();
        if (mpf == null)
            return null;   // no master password  saved
        try {
            PasswordAdapter pw = new PasswordAdapter(mpf.getAbsolutePath(),
                    "master-password".toCharArray()); // fixed key
            return pw.getPasswordForAlias("master-password");
        }
        catch (Exception e) {
            logger.log(Level.FINER, "master password file reading error: {0}", e.getMessage());
            return null;
        }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

            for (File f : files) {
                //the following property is required for initializing the password helper
                System.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY, f.getAbsolutePath());
                try {
                    final PasswordAdapter pa = new PasswordAdapter(null);
                    final boolean exists = pa.aliasExists(alias);
                    if (exists) {
                        String mPass = getMasterPassword(f.getName());
                        expandedPassword = new PasswordAdapter(mPass.toCharArray()).getPasswordForAlias(alias);
                    }
                }
                catch (Exception e) {
                    if (logger.isLoggable(Level.FINER)) {
                        logger.finer(StringUtils.cat(": ", alias, e.getMessage()));
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

     * @throws CommandException
     */
    protected void createMasterPasswordFile(String masterPassword) throws CommandException {
        final File pwdFile = new File(this.getServerDirs().getAgentDir(), MASTER_PASSWORD_ALIAS);
        try {
            PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                MASTER_PASSWORD_ALIAS.toCharArray());
            p.setPasswordForAlias(MASTER_PASSWORD_ALIAS, masterPassword.getBytes());
            chmod("600", pwdFile);
        } catch (Exception ex) {
            throw new CommandException(Strings.get("masterPasswordFileNotCreated", pwdFile),
                ex);
        }
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

     * @throws CommandException
     */
    protected void createMasterPasswordFile() throws CommandException {
        final File pwdFile = new File(this.getServerDirs().getAgentDir(), MASTER_PASSWORD_ALIAS);
        try {
            PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(),
                MASTER_PASSWORD_ALIAS.toCharArray());
            p.setPasswordForAlias(MASTER_PASSWORD_ALIAS, newPassword.getBytes());
            pwdFile.setReadable(true);
            pwdFile.setWritable(true);
        } catch (Exception ex) {
            throw new CommandException(strings.get("masterPasswordFileNotCreated", pwdFile),
                ex);
View Full Code Here

Examples of com.sun.enterprise.security.store.PasswordAdapter

        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(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.