Search in sources :

Example 21 with ViewBeanManager

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

the class AuthenticationServletBase method onPageSessionDeserializationException.

@Override
protected void onPageSessionDeserializationException(RequestContext requestContext, ViewBean viewBean, Exception e) throws ServletException, IOException {
    ViewBeanManager viewBeanManager = requestContext.getViewBeanManager();
    AuthExceptionViewBean vb = (AuthExceptionViewBean) viewBeanManager.getViewBean(com.sun.identity.authentication.UI.AuthExceptionViewBean.class);
    if (exDebug.messageEnabled()) {
        exDebug.message("AuthenticationServletBase.onPageSessionDeserializationException:", e);
    }
    vb.forwardTo(requestContext);
    throw new CompleteRequestException();
}
Also used : CompleteRequestException(com.iplanet.jato.CompleteRequestException) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Example 22 with ViewBeanManager

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

the class AuthenticationServletBase method onRequestHandlerNotSpecified.

/**
     * Forwards to login view bean, in case of no handler specified
     *
     * @param requestContext - request context
     * @throws ServletException
     */
protected void onRequestHandlerNotSpecified(RequestContext requestContext) throws ServletException {
    ViewBeanManager viewBeanManager = requestContext.getViewBeanManager();
    AuthExceptionViewBean vb = (AuthExceptionViewBean) viewBeanManager.getViewBean(com.sun.identity.authentication.UI.AuthExceptionViewBean.class);
    vb.forwardTo(requestContext);
    throw new CompleteRequestException();
}
Also used : CompleteRequestException(com.iplanet.jato.CompleteRequestException) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Example 23 with ViewBeanManager

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

the class LoginServlet method initializeRequestContext.

/**
     *
     *
     */
protected void initializeRequestContext(RequestContext requestContext) {
    super.initializeRequestContext(requestContext);
    // Set a view bean manager in the request context.  This must be
    // done at the module level because the view bean manager is
    // module specifc.
    ViewBeanManager viewBeanManager = new ViewBeanManager(requestContext, PACKAGE_NAME);
    ((RequestContextImpl) requestContext).setViewBeanManager(viewBeanManager);
    HttpServletRequest request = requestContext.getRequest();
    HttpServletResponse response = requestContext.getResponse();
    // by redirecting the response with dummy cookie.
    if (checkForCookiesInBrowser(request, response, debug)) {
        throw new CompleteRequestException();
    }
    // Check content length
    try {
        RequestUtils.checkContentLength(request);
    } catch (L10NMessageImpl e) {
        if (debug.messageEnabled()) {
            ISLocaleContext localeContext = new ISLocaleContext();
            localeContext.setLocale(request);
            java.util.Locale locale = localeContext.getLocale();
            debug.message("LoginServlet: " + e.getL10NMessage(locale));
        }
        AuthExceptionViewBean vb = (AuthExceptionViewBean) viewBeanManager.getViewBean(com.sun.identity.authentication.UI.AuthExceptionViewBean.class);
        vb.forwardTo(requestContext);
        throw new CompleteRequestException();
    }
    // Check if the hostname in the URL is an FQDN else
    // redirect to the fqdn
    String client_type = AuthUtils.getClientType(request);
    if (debug.messageEnabled()) {
        debug.message("Client Type = " + client_type);
    }
    String hostName = AuthUtils.getHostName(request);
    if (!AuthUtils.isValidFQDNRequest(hostName)) {
        try {
            String newHN = AuthUtils.getValidFQDNResource(hostName, request);
            if (debug.messageEnabled()) {
                debug.message("FQDN = " + newHN);
            }
            if (AuthUtils.isGenericHTMLClient(client_type)) {
                debug.message("This is HTML");
                response.sendRedirect(newHN);
            } else {
                String fileName = AuthUtils.getDefaultFileName(request, REDIRECT_JSP);
                if (debug.messageEnabled()) {
                    debug.message("Forward to : " + fileName);
                }
                RequestDispatcher dispatcher = request.getRequestDispatcher(fileName);
                dispatcher.forward(request, response);
            }
        } catch (Exception e) {
        // came here continue
        }
        throw new CompleteRequestException();
    }
    final boolean isLoginRequest = LOGIN_PAGE_NAME.equals(getPageName(request));
    String cookieURL = AuthUtils.getCookieURLForSessionUpgrade(request);
    if (cookieURL != null && isLoginRequest) {
        rerouteRequest(request, response, cookieURL);
        return;
    }
    // Check whether this is the correct server to accept the client
    // response.
    String authCookieValue = AuthUtils.getAuthCookieValue(request);
    if ((authCookieValue != null) && (authCookieValue.length() != 0) && (!authCookieValue.equalsIgnoreCase("LOGOUT"))) {
        //send Auth request to cookie (original) server
        try {
            SessionID sessionID = new SessionID(authCookieValue);
            cookieURL = AuthUtils.getCookieURL(sessionID);
        } catch (Exception e) {
            if (debug.messageEnabled()) {
                debug.message("LoginServlet error in Session : " + e.toString());
            }
        }
        if (debug.messageEnabled()) {
            debug.message("cookieURL : " + cookieURL);
        }
        if (isLoginRequest && cookieURL != null && !cookieURL.isEmpty() && !AuthUtils.isLocalServer(cookieURL, true) && !AuthUtils.isSessionUpgradeOrForceAuth(request)) {
            rerouteRequest(request, response, cookieURL);
        }
    }
}
Also used : L10NMessageImpl(com.sun.identity.shared.locale.L10NMessageImpl) RequestContextImpl(com.iplanet.jato.RequestContextImpl) CompleteRequestException(com.iplanet.jato.CompleteRequestException) HttpServletResponse(javax.servlet.http.HttpServletResponse) ViewBeanManager(com.iplanet.jato.ViewBeanManager) RequestDispatcher(javax.servlet.RequestDispatcher) ServletException(javax.servlet.ServletException) CompleteRequestException(com.iplanet.jato.CompleteRequestException) HttpServletRequest(javax.servlet.http.HttpServletRequest) ISLocaleContext(com.sun.identity.common.ISLocaleContext) SessionID(com.iplanet.dpro.session.SessionID)

Example 24 with ViewBeanManager

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

the class PWResetServlet method onPageSessionDeserializationException.

@Override
protected void onPageSessionDeserializationException(RequestContext requestContext, ViewBean viewBean, Exception e) throws ServletException, IOException {
    ViewBeanManager viewBeanManager = requestContext.getViewBeanManager();
    ViewBean targetView = viewBeanManager.getViewBean(PWResetInvalidURLViewBean.class);
    targetView.forwardTo(requestContext);
    throw new CompleteRequestException();
}
Also used : CompleteRequestException(com.iplanet.jato.CompleteRequestException) ViewBeanManager(com.iplanet.jato.ViewBeanManager) ViewBean(com.iplanet.jato.view.ViewBean)

Example 25 with ViewBeanManager

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

the class PWResetServlet method initializeRequestContext.

/**
     * Initializes request context
     *
     * @param requestContext  request context
     */
protected void initializeRequestContext(RequestContext requestContext) {
    super.initializeRequestContext(requestContext);
    // Set a view bean manager in the request context.  This must be
    // done at the module level because the view bean manager is
    ViewBeanManager viewBeanManager = new ViewBeanManager(requestContext, PACKAGE_NAME);
    ((RequestContextImpl) requestContext).setViewBeanManager(viewBeanManager);
}
Also used : RequestContextImpl(com.iplanet.jato.RequestContextImpl) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Aggregations

ViewBeanManager (com.iplanet.jato.ViewBeanManager)30 RequestContextImpl (com.iplanet.jato.RequestContextImpl)18 CompleteRequestException (com.iplanet.jato.CompleteRequestException)10 ViewBean (com.iplanet.jato.view.ViewBean)6 SessionID (com.iplanet.dpro.session.SessionID)1 LoginViewBean (com.sun.identity.authentication.UI.LoginViewBean)1 ISLocaleContext (com.sun.identity.common.ISLocaleContext)1 L10NMessageImpl (com.sun.identity.shared.locale.L10NMessageImpl)1 RequestDispatcher (javax.servlet.RequestDispatcher)1 ServletException (javax.servlet.ServletException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 JspException (javax.servlet.jsp.JspException)1