01: package com.sun.portal.rproxy.admin;
02:
03: import com.iplanet.am.console.base.AMMessageViewBean;
04: import com.iplanet.am.console.base.model.AMAdminTypes;
05: import com.iplanet.am.console.components.view.html.MessageBox;
06: import com.iplanet.am.sdk.AMRole;
07: import com.iplanet.jato.RequestContext;
08: import com.iplanet.jato.RequestContextImpl;
09: import com.iplanet.jato.ViewBeanManager;
10: import com.iplanet.sso.SSOException;
11: import com.iplanet.sso.SSOToken;
12: import com.iplanet.sso.SSOTokenManager;
13:
14: public class GatewayConsoleServlet extends GatewayConsoleServletBase {
15:
16: public static final String DEFAULT_MODULE_URL = "../gwadmin";
17:
18: public static String PACKAGE_NAME = getPackageName(GatewayConsoleServlet.class
19: .getName());
20:
21: public GatewayConsoleServlet() {
22: super ();
23: }
24:
25: protected void initializeRequestContext(
26: RequestContext requestContext) {
27: super .initializeRequestContext(requestContext);
28:
29: // Set a view bean manager in the request context. This must be
30: // done at the module level because the view bean manager is
31: // module specifc.
32: ViewBeanManager viewBeanManager = new ViewBeanManager(
33: requestContext, PACKAGE_NAME);
34: ((RequestContextImpl) requestContext)
35: .setViewBeanManager(viewBeanManager);
36:
37: try {
38: SSOTokenManager manager = SSOTokenManager.getInstance();
39: SSOToken ssoToken = manager.createSSOToken(requestContext
40: .getRequest());
41: int userType = new AMAdminTypes(ssoToken).getUserType();
42: if (userType != AMRole.TOP_LEVEL_ADMIN_ROLE) {
43: GatewayAdminModelManager gwMgr = (GatewayAdminModelManager) requestContext
44: .getModelManager();
45: AMMessageViewBean msgBoxVB = (AMMessageViewBean) viewBeanManager
46: .getViewBean(com.iplanet.am.console.base.AMMessageViewBean.class);
47: msgBoxVB.setTitle(gwMgr
48: .getString("notsuperadminmsgbox.title"));
49: msgBoxVB.setMessage(gwMgr
50: .getString("notsuperadminmsgbox.msg"));
51: msgBoxVB.setMessageType(MessageBox.TYPE_ERROR);
52: msgBoxVB.forwardTo(requestContext);
53: }
54: } catch (SSOException ssoe) {
55: debug
56: .warning("Gateway Admin Console Servlet Base MSG: Non authenticated user");
57: /*
58: * String redirectURL = serverURI + "/login" +
59: * "?module=dproadmin&goto=" + consoleURI + "/base/AMAdminFrame";
60: *
61: * debug.warning("Gateway Admin Console Servlet Base MSG: Non
62: * authenticated user," + "redirecting to " + redirectURL); try {
63: * requestContext.getResponse().sendRedirect(redirectURL); } catch
64: * (IOException ioe) { debug.warning("Gateway Admin Console Servlet
65: * Base MSG: cannot redirect non authenticated user to:" +
66: * redirectURL + "exception:" + ioe); }
67: */
68: }
69: }
70:
71: public String getModuleURL() {
72: return DEFAULT_MODULE_URL;
73: }
74: }
|