Package com.adito.security.forms

Examples of com.adito.security.forms.UpdatePrivateKeyPassphraseForm


     * @return forward
     * @throws Exception
     */
    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        UpdatePrivateKeyPassphraseForm f = (UpdatePrivateKeyPassphraseForm) form;
       
        if (f.isResetPrivateKey()){
            // user has opted to reset his key, this will mean all personal info will be lost.
            PublicKeyStore.getInstance().removeKeys(getSessionInfo(request).getUser().getPrincipalName());
            return cleanUpAndReturn(mapping, request, mapping.findForward("confirmReset"));
        }
        else{
            /*
             * Need to verify using the old password so the confidential
             * user attributes can be decrypted
             */
            try {
                PublicKeyStore.getInstance().verifyPrivateKey(getSessionInfo(request).getUser().getPrincipalName(), f.getOldPassphrase().toCharArray());
            } catch (UpdatePrivateKeyPassphraseException upkpe) {
                // incorrect passphrase
                ActionErrors errs = new ActionErrors();
                errs.add(Globals.ERROR_KEY, new ActionMessage("updatePrivateKeyPassphrase.error.incorrectPassphrase"));
                saveErrors(request.getSession(), errs);
                return mapping.getInputForward();
            }

            /*
             * Now change the passphrase
             */
            PublicKeyStore.getInstance().changePrivateKeyPassphrase(
                            getSessionInfo(request).getUser().getPrincipalName(),
                            f.getOldPassphrase(),
                            new String(LogonControllerFactory.getInstance().getPasswordFromCredentials(
                                            getSessionInfo(request).getCredentials())));
            return cleanUpAndReturn(mapping, request, mapping.findForward("success"));
        }
    }
View Full Code Here

TOP

Related Classes of com.adito.security.forms.UpdatePrivateKeyPassphraseForm

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.