Package com.adito.security.forms

Examples of com.adito.security.forms.PromptForPrivateKeyPassphraseForm


    /* (non-Javadoc)
     * @see org.apache.struts.actions.DispatchAction#unspecified(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        PromptForPrivateKeyPassphraseForm f = (PromptForPrivateKeyPassphraseForm) form;
        f.setNewKey(!PublicKeyStore.getInstance().hasPrivateKey(getSessionInfo(request).getUser().getPrincipalName()));
        return mapping.findForward("display");
    }
View Full Code Here


     * @return forward
     * @throws Exception
     */
    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        PromptForPrivateKeyPassphraseForm f = (PromptForPrivateKeyPassphraseForm) form;
        SessionInfo session = getSessionInfo(request);
        UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(session.getUser().getRealm());
        if(!udb.checkPassword(session.getUser().getPrincipalName(),
            f.getPassphrase())) {
          // User has entered incorrect passphrase - go back
          ActionErrors errs = new ActionErrors();
            errs.add(Globals.ERROR_KEY, new ActionMessage("promptForPrivateKeyPassphrase.error.incorrectPassphrase"));
            saveErrors(request.getSession(), errs);
            return mapping.getInputForward();         
        }
       
        // Now check to see if the password has been added to the authentication scheme
        AuthenticationScheme scheme = (AuthenticationScheme) getSessionInfo(request).getHttpSession().getAttribute(Constants.AUTH_SESSION);
        if(LogonControllerFactory.getInstance().getPasswordFromCredentials(scheme)==null) {
          // No so lets add it
          scheme.addCredentials(new PasswordCredentials(getSessionInfo(request).getUser().getPrincipalName(), f.getPassphrase().toCharArray()));
        }
       
        try {
            PublicKeyStore.getInstance().verifyPrivateKey(getSessionInfo(request).getUser().getPrincipalName(), f.getPassphrase().toCharArray());
        }
        catch(UpdatePrivateKeyPassphraseException upkpe) {

          // LDP - This code was incorrectly adding a bad logon warning. What we actually have to
          // do is redirect back again to the UpdatePrivateKeyPassphraseIntercerptListener
View Full Code Here

TOP

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

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.