Package com.sun.enterprise.security.store

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


     */
    public void execute(AdminCommandContext context) {
        final ActionReport report = context.getActionReport();

        try {
            PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter();
            if (pa.getPasswordForAlias(aliasName) == null) {
                report.setMessage(localStrings.getLocalString(
                    "delete.password.alias.notfound",
                    "Password alias for the alias {0} does not exist.",
                    aliasName));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }

            pa.removeAlias(aliasName);
        } catch (Exception ex) {
            ex.printStackTrace();
            report.setMessage(localStrings.getLocalString(
                "delete.password.alias.fail",
                "Deletion of Password Alias {0} failed", aliasName));
View Full Code Here


     */
    public void execute(AdminCommandContext context) {
        final ActionReport report = context.getActionReport();
       
        try {
            PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter();
            if (pa.getPasswordForAlias(aliasName) != null) {
                report.setMessage(localStrings.getLocalString(
                    "create.password.alias.alreadyexists",
                    "Password alias with the specified name already exists. " +
                    "Please use the update-password-alias command to change it",
                    aliasName));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }

            pa.setPasswordForAlias(aliasName,aliasPassword.getBytes());

        } catch (Exception ex) {
            ex.printStackTrace();
            report.setMessage(localStrings.getLocalString(
                "create.password.alias.fail",
View Full Code Here

     */
    public void execute(AdminCommandContext context) {
        final ActionReport report = context.getActionReport();

        try {
            PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter();

            if (pa.getPasswordForAlias(aliasName) == null) {
                report.setMessage(localStrings.getLocalString(
                    "update.password.alias.notfound",
                    "Password alias for the alias {0} does not exist.",
                    aliasName));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }

            pa.setPasswordForAlias(aliasName,aliasPassword.getBytes());
        } catch (Exception ex) {
            ex.printStackTrace();
            report.setMessage(localStrings.getLocalString(
                "update.password.alias.fail",
                "Update of Password Alias {0} failed", aliasName));
View Full Code Here

            }
        } catch (final Exception e) { //underlying code is unsafe!
            return (at);
        }
        final String          an = RelativePathResolver.getAlias(at);
        final PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter(); // 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

    }
   
    private synchronized PasswordAdapter pa() {
        if (pa == null) {
            try {
                pa = new PasswordAdapter(pathToAliasStore, storePassword);
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            } finally {
                Arrays.fill(storePassword, 0, storePassword.length, '\0');
                storePassword = null;
View Full Code Here

                //the following property is required for initializing the password helper
                System.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY, f.getAbsolutePath());
                try {
                    final MasterPassword masterPasswordHelper = Globals.getDefaultHabitat().getComponent(MasterPassword.class, "Security SSL Password Provider Service");

                    final PasswordAdapter pa = masterPasswordHelper.getMasterPasswordAdapter();
                    final boolean exists = pa.aliasExists(alias);
                    if (exists) {
                        String mPass = getMasterPassword(f.getName());
                        masterPasswordHelper.setMasterPassword(mPass.toCharArray());
                        expandedPassword = masterPasswordHelper.getMasterPasswordAdapter().getPasswordForAlias(alias);
                    }
View Full Code Here

     * @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

     * @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

TOP

Related Classes of com.sun.enterprise.security.store.PasswordAdapter

Copyright © 2018 www.massapicom. 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.