Search in sources :

Example 16 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class RedirectToRealmHomeViewBean method redirectToHome.

protected void redirectToHome() {
    if (XuiRedirectHelper.isXuiAdminConsoleEnabled()) {
        RequestContext rc = RequestManager.getRequestContext();
        try {
            String realm = URLEncoder.encode(rc.getRequest().getParameter("realm"), "UTF-8");
            rc.getResponse().sendRedirect("../XUI#realms/" + realm + "/dashboard");
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException("UTF-8 not supported", e);
        } catch (IOException e) {
            debug.message("Unexpected IOException during redirect", e);
        }
    } else {
        HomeViewBean vb = (HomeViewBean) getViewBean(HomeViewBean.class);
        backTrail();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    }
}
Also used : UnsupportedEncodingException(java.io.UnsupportedEncodingException) RequestContext(com.iplanet.jato.RequestContext) IOException(java.io.IOException)

Example 17 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class PWResetQuestionViewBean method handleBtnOKRequest.

/**
     * Handles form submission request for next button. It will
     * forward to <code>PWResetSuccessViewBean</code> if the answers
     * are correct for the questions.
     *
     * @param event request invocation event
     */
public void handleBtnOKRequest(RequestInvocationEvent event) {
    PWResetQuestionModel model = (PWResetQuestionModel) getModel();
    String orgDN = (String) getPageSessionAttribute(ORG_DN);
    String userDN = (String) getPageSessionAttribute(USER_DN);
    RequestContext reqContext = event.getRequestContext();
    ISLocaleContext localeContext = new ISLocaleContext();
    localeContext.setLocale(reqContext.getRequest());
    java.util.Locale localeObj = localeContext.getLocale();
    String locale = localeObj.toString();
    model.setUserLocale(locale);
    PWResetQuestionTiledView tView = (PWResetQuestionTiledView) getChild(PASSWORD_RESET_TILEDVIEW);
    Map map = tView.getAnswers();
    if (tView.isAnswerBlank()) {
        setErrorMessage(model.getErrorTitle(), model.getMissingAnswerMessage());
        forwardTo();
    } else {
        try {
            model.resetPassword(userDN, orgDN, map);
            PWResetSuccessViewBean vb = (PWResetSuccessViewBean) getViewBean(PWResetSuccessViewBean.class);
            vb.setResetMessage(model.getPasswordResetMessage());
            vb.setPageSessionAttribute(URL_LOCALE, locale);
            vb.forwardTo(getRequestContext());
        } catch (PWResetException pwe) {
            if (!model.isUserLockout(userDN, orgDN)) {
                setErrorMessage(model.getErrorTitle(), pwe.getMessage());
            }
            forwardTo();
        }
    }
}
Also used : PWResetException(com.sun.identity.password.ui.model.PWResetException) RequestContext(com.iplanet.jato.RequestContext) ISLocaleContext(com.sun.identity.common.ISLocaleContext) Map(java.util.Map) PWResetQuestionModel(com.sun.identity.password.ui.model.PWResetQuestionModel)

Example 18 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class PWResetUserValidationViewBean method handleBtnNextRequest.

/**
     * Handles form submission request
     *
     * @param event request invocation event
     */
public void handleBtnNextRequest(RequestInvocationEvent event) {
    PWResetUserValidationModel model = (PWResetUserValidationModel) getModel();
    String userAttrValue = (String) getDisplayFieldValue(TF_USER_ATTR);
    if (userAttrValue != null) {
        userAttrValue = userAttrValue.trim();
    }
    HiddenField hf = (HiddenField) getChild(FLD_USER_ATTR);
    String userAttrName = (String) hf.getValue();
    String orgDN = (String) getPageSessionAttribute(ORG_DN);
    String orgDNFlag = (String) getPageSessionAttribute(ORG_DN_FLAG);
    RequestContext reqContext = event.getRequestContext();
    ISLocaleContext localeContext = new ISLocaleContext();
    localeContext.setLocale(reqContext.getRequest());
    java.util.Locale localeObj = localeContext.getLocale();
    String locale = localeObj.toString();
    model.setUserLocale(locale);
    if (orgDNFlag != null && orgDNFlag.equals(STRING_TRUE)) {
        model.setRealmFlag(true);
    }
    if (userAttrValue == null || userAttrValue.length() == 0) {
        setErrorMessage(model.getErrorTitle(), model.getMissingUserAttrMessage(userAttrName));
        forwardTo();
    } else {
        if (model.isUserAttrValueValid(orgDN, userAttrValue) && model.isUserExists(userAttrValue, userAttrName, orgDN) && model.isUserActive(model.getUserRealm())) {
            forwardToPWResetQuestionVB(orgDN, userAttrValue, orgDNFlag, locale);
        } else {
            setErrorMessage(model.getErrorTitle(), model.getErrorMessage());
            forwardTo();
        }
    }
}
Also used : PWResetUserValidationModel(com.sun.identity.password.ui.model.PWResetUserValidationModel) HiddenField(com.iplanet.jato.view.html.HiddenField) RequestContext(com.iplanet.jato.RequestContext) ISLocaleContext(com.sun.identity.common.ISLocaleContext)

Example 19 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class AMAdminFrameViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    AMViewConfig config = AMViewConfig.getInstance();
    RequestContext rc = getRequestContext();
    String startDN = AMModelBase.getStartDN(rc.getRequest());
    String url = config.getDefaultViewBeanURL(startDN, rc.getRequest());
    if ((url != null) && (url.length() > 0)) {
        setDisplayFieldValue(VIEWBEAN_URL, url);
    } else {
        /* 
             * We couldn't retrieve the default view to display.
             * This may be due to permission problems, or a configuration
             * issue. If the users profile is set to ignore, display
             * the "Authenticated View". 
             */
        AMModel model = getModel();
        if (model.ignoreUserProfile()) {
            AuthenticatedViewBean vb = (AuthenticatedViewBean) getViewBean(AuthenticatedViewBean.class);
            passPgSessionMap(vb);
            vb.forwardTo(rc);
        }
        //set the non admin end user view
        setDisplayFieldValue(VIEWBEAN_URL, "../idm/EndUser");
    }
}
Also used : AMModel(com.sun.identity.console.base.model.AMModel) RequestContext(com.iplanet.jato.RequestContext)

Example 20 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class EditAuthTypeViewBean method getAuthModel.

private AuthPropertiesModel getAuthModel() {
    if (authModel == null) {
        RequestContext rc = RequestManager.getRequestContext();
        authModel = new AuthPropertiesModelImpl(rc.getRequest(), getPageSessionAttributes());
    }
    return authModel;
}
Also used : RequestContext(com.iplanet.jato.RequestContext) AuthPropertiesModelImpl(com.sun.identity.console.authentication.model.AuthPropertiesModelImpl)

Aggregations

RequestContext (com.iplanet.jato.RequestContext)32 HttpServletRequest (javax.servlet.http.HttpServletRequest)20 IOException (java.io.IOException)5 AuthConfigurationModelImpl (com.sun.identity.console.authentication.model.AuthConfigurationModelImpl)3 AuthPropertiesModelImpl (com.sun.identity.console.authentication.model.AuthPropertiesModelImpl)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)3 AMModelBase (com.sun.identity.console.base.model.AMModelBase)3 ISLocaleContext (com.sun.identity.common.ISLocaleContext)2 DelegationModelImpl (com.sun.identity.console.delegation.model.DelegationModelImpl)2 EntityModelImpl (com.sun.identity.console.federation.model.EntityModelImpl)2 RestSTSInstanceModel (com.sun.identity.console.sts.model.RestSTSInstanceModel)2 SoapSTSInstanceModel (com.sun.identity.console.sts.model.SoapSTSInstanceModel)2 PWResetUserValidationModel (com.sun.identity.password.ui.model.PWResetUserValidationModel)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 DataInputStream (java.io.DataInputStream)2 InputStream (java.io.InputStream)2 ServletOutputStream (javax.servlet.ServletOutputStream)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 CompleteRequestException (com.iplanet.jato.CompleteRequestException)1 HiddenField (com.iplanet.jato.view.html.HiddenField)1