Package org.gridsphere.provider.portletui.beans

Examples of org.gridsphere.provider.portletui.beans.TextBean



    public void start(RenderFormEvent event) throws PortletException {
        log.debug("Entering start");
        RenderRequest request = event.getRenderRequest();
        TextBean errorMessage = event.getTextBean(ERROR_MESSAGE);
        errorMessage.setStyle("error");
        errorMessage.setValue(null);

        User user = getUser(request);
        GSSCredential cred = credentialManager.getDefaultCredential(user);
        if (cred == null) {
            log.error("No active credential found.");
View Full Code Here



    public void downloadsCredentialByPKCS12(ActionFormEvent event) {
        log.debug("Entering downloadsCredentialByPKCS12");
        ActionRequest request  = event.getActionRequest();
        TextBean errorMessage = event.getTextBean(ERROR_MESSAGE);
        errorMessage.setStyle("error");
        errorMessage.setValue(null);

        String epassword = request.getParameter("epassword");
        String vepassword = request.getParameter("vepassword");

        if ( isBlank(epassword) || isBlank(vepassword) ) {
            log.error("No password given");
            errorMessage.setValue("No password given");
            setNextState(request, MAIN_VIEW_JSP);
            return ;
        }

        if ( ! epassword.equals(vepassword) ) {
            log.error("Mismatched passwords.");
            errorMessage.setValue("Mismatched passwords");
            setNextState(request, MAIN_VIEW_JSP);
            return ;
        }

        User user = getUser(request);
        GSSCredential cred = credentialManager.getDefaultCredential(user);
        if (cred == null) {
            log.error("No active credential found.");
            setNextState(request, NO_CREDENTIAL_JSP);
            return ;
        }

        File p12File = exportPKCS12(cred, user.getUserName(), epassword);
        if (p12File == null) {
            errorMessage.setValue("Failed to export the PKCS#12 certificate");
            setNextState(request, MAIN_VIEW_JSP);
            return ;
        }
        log.debug("Export file: " + p12File);
View Full Code Here

    public void validateOid(ActionFormEvent event) {
        log.debug("Entering validateOid");
        PortletRequest req = event.getActionRequest();
        PortletSession sess = req.getPortletSession();

        TextBean errorMessage = event.getTextBean("errorMessage");
        errorMessage.setStyle("error");

        sess.removeAttribute(PROCESSING_REQUEST);
        sess.removeAttribute(PIN_VALIDATED);

        String emailOid = req.getParameter("oid");
        log.debug("activateAccount got an emailOid: " + emailOid);

        AccountRequest accountRequest = null;
        try {
            accountRequest = checkEmailOid(emailOid);
        } catch (Exception e) {
            errorMessage.setValue(e.getMessage());
            setNextState(req, OID_PROMPT_JSP);
            return ;
        }

        if ( ! readyToActivate(accountRequest) ) {
            setNextState(req, ERROR_JSP);
            return ;
        }

        log.info("Got a valid accountRequest that needs activation; now prompting for PIN Number");

        sess.setAttribute(PROCESSING_REQUEST, accountRequest);
        errorMessage.setValue(null);

        setNextState(req, PIN_PROMPT_JSP);
        log.debug("Exit validateOid");
    }
View Full Code Here

    public void validatePINNumber(ActionFormEvent event) {
        log.debug("Entering validatePINNumber");
        PortletRequest req = event.getActionRequest();
        PortletSession sess = req.getPortletSession();

        TextBean errorMessage = event.getTextBean("errorMessage");
        errorMessage.setStyle("error");

        AccountRequest accountRequest =
            (AccountRequest)sess.getAttribute(PROCESSING_REQUEST);
        if (accountRequest == null) {
            log.error("Couldn't get AccountRequest from Session Attribute.");
            errorMessage.setValue("There was an error processing your request. Please click the link in the email you received again to start the process over, or contact the portal administrator if you continue to see this message.");
            setNextState(req, ERROR_JSP);
            return ;
        }

        String pin = req.getParameter("pinNumber");
        String pinNumber = null;
        if ( accountRequest.isRenewRequest() ) {
            log.info("Requests Account Renewal.");
            pinNumber = accountRequest.getAttribute("renewPIN");
        } else if (accountRequest.isResetRequest() ) {
            log.info("Requests to reset account.");
            pinNumber = accountRequest.getAttribute("resetPIN");
        } else {
            log.info("Requests Account Activation.");
            pinNumber = accountRequest.getAttribute("pinNumber");
        }
        try {
            checkPIN(pin, pinNumber);
        } catch (Exception e) {
            log.error(e.getMessage());
            errorMessage.setValue(e.getMessage());
            setNextState(req, PIN_PROMPT_JSP);
            return ;
        }

        log.info("Got a matching PIN number; prompting for password...");
        sess.setAttribute(PIN_VALIDATED, Boolean.TRUE);
        errorMessage.setValue(null);

        setNextState(req, PASSWORD_PROMPT_JSP);
        log.debug("Exit validatePINNumber");
    }
View Full Code Here

        PortletRequest req = event.getActionRequest();
        ActionResponse res = event.getActionResponse();
        PortletSession sess = req.getPortletSession();

        Boolean pinValidated = (Boolean) sess.getAttribute(PIN_VALIDATED);
        TextBean errorMessage = event.getTextBean("errorMessage");
        errorMessage.setStyle("error");

        if ( ! isPINValidated(pinValidated) ) {
            sess.setAttribute(PIN_VALIDATED, Boolean.FALSE);
            errorMessage.setValue("Error. You must enter PIN number.");
            setNextState(req, PIN_PROMPT_JSP);
            return ;
        }

        AccountRequest accountRequest =
            (AccountRequest)sess.getAttribute(PROCESSING_REQUEST);
        if (accountRequest == null) {
            errorMessage.setValue("There was an error processing your request. Please click the link in the email you received again to start the process over, or contact the portal administrator if you continue to see this message.");
            sess.removeAttribute(PROCESSING_REQUEST);
            sess.setAttribute(PIN_VALIDATED, Boolean.FALSE);
            setNextState(req, ERROR_JSP);
            return ;
        }

        String password1 = req.getParameter("password1");
        String password2 = req.getParameter("password2");
        try {
            checkPassword(password1, password2, accountRequest);
        } catch (Exception e) {
            log.info(e.getMessage());
            errorMessage.setValue(e.getMessage());
            setNextState(req, PASSWORD_PROMPT_JSP);
            return ;
        }

        // activation proc
        Map params = new HashMap();
        params.put("password", password1);
        AccountRequestResult result =
            accountService.updateAccount(accountRequest,
                                         AccountRequest.Status.ACTIVATED,
                                         params);
        if (result.isError()) {
            errorMessage.setValue( result.getMessage() );
            setNextState(req, ERROR_JSP);
            return ;
        }

        errorMessage.setValue(null);
        sess.removeAttribute(PROCESSING_REQUEST);
        sess.removeAttribute(PIN_VALIDATED);

        res.setRenderParameter("username", accountRequest.getUsername());
View Full Code Here

TOP

Related Classes of org.gridsphere.provider.portletui.beans.TextBean

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.