Search in sources :

Example 11 with RequestContextImpl

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

the class AuditServlet method initializeRequestContext.

/**
     * Initialize request context and set the viewbean manager.
     *
     * @param requestContext current request context
     */
protected void initializeRequestContext(RequestContext requestContext) {
    super.initializeRequestContext(requestContext);
    ViewBeanManager viewBeanManager = new ViewBeanManager(requestContext, PACKAGE_NAME);
    ((RequestContextImpl) requestContext).setViewBeanManager(viewBeanManager);
}
Also used : RequestContextImpl(com.iplanet.jato.RequestContextImpl) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Example 12 with RequestContextImpl

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

the class PMServlet method initializeRequestContext.

/**
     * Initialize request context and set the viewbean manager
     * @param requestContext current request context
     */
protected void initializeRequestContext(RequestContext requestContext) {
    super.initializeRequestContext(requestContext);
    ViewBeanManager viewBeanManager = new ViewBeanManager(requestContext, PACKAGE_NAME);
    ((RequestContextImpl) requestContext).setViewBeanManager(viewBeanManager);
}
Also used : RequestContextImpl(com.iplanet.jato.RequestContextImpl) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Example 13 with RequestContextImpl

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

the class SMServlet method initializeRequestContext.

/**
     * Initialize request context and set the viewbean manager.
     * @param requestContext current request context.
     */
protected void initializeRequestContext(RequestContext requestContext) {
    super.initializeRequestContext(requestContext);
    ViewBeanManager viewBeanManager = new ViewBeanManager(requestContext, PACKAGE_NAME);
    ((RequestContextImpl) requestContext).setViewBeanManager(viewBeanManager);
}
Also used : RequestContextImpl(com.iplanet.jato.RequestContextImpl) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Example 14 with RequestContextImpl

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

the class WSServlet method initializeRequestContext.

/**
     * Initialize request context and set the viewbean manager
     * @param requestContext current request context
     */
protected void initializeRequestContext(RequestContext requestContext) {
    super.initializeRequestContext(requestContext);
    ViewBeanManager viewBeanManager = new ViewBeanManager(requestContext, PACKAGE_NAME);
    ((RequestContextImpl) requestContext).setViewBeanManager(viewBeanManager);
}
Also used : RequestContextImpl(com.iplanet.jato.RequestContextImpl) ViewBeanManager(com.iplanet.jato.ViewBeanManager)

Example 15 with RequestContextImpl

use of com.iplanet.jato.RequestContextImpl 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)

Aggregations

RequestContextImpl (com.iplanet.jato.RequestContextImpl)18 ViewBeanManager (com.iplanet.jato.ViewBeanManager)18 SessionID (com.iplanet.dpro.session.SessionID)1 CompleteRequestException (com.iplanet.jato.CompleteRequestException)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