AjaxProxy.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
1e83c8de3aa48b316b28057d53995272baf1260cwrowe DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
1e83c8de3aa48b316b28057d53995272baf1260cwrowe The contents of this file are subject to the terms
1e83c8de3aa48b316b28057d53995272baf1260cwrowe of the Common Development and Distribution License
1e83c8de3aa48b316b28057d53995272baf1260cwrowe (the License). You may not use this file except in
1e83c8de3aa48b316b28057d53995272baf1260cwrowe compliance with the License.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe You can obtain a copy of the License at
1e83c8de3aa48b316b28057d53995272baf1260cwrowe See the License for the specific language governing
1e83c8de3aa48b316b28057d53995272baf1260cwrowe permission and limitations under the License.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe When distributing Covered Code, include this CDDL
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Header Notice in each file and include the License file
1e83c8de3aa48b316b28057d53995272baf1260cwrowe If applicable, add the following below the CDDL Header,
1e83c8de3aa48b316b28057d53995272baf1260cwrowe with the fields enclosed by brackets [] replaced by
1e83c8de3aa48b316b28057d53995272baf1260cwrowe your own identifying information:
1e83c8de3aa48b316b28057d53995272baf1260cwrowe "Portions Copyrighted [year] [name of copyright owner]"
1e83c8de3aa48b316b28057d53995272baf1260cwrowe $Id: AjaxProxy.jsp,v 1.7 2009/08/04 20:50:49 asyhuang Exp $
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Portions Copyrighted 2012 ForgeRock Inc
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Portions Copyrighted 2012 Open Source Solution Technology Corporation
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.iplanet.am.util.SystemProperties"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.iplanet.sso.SSOException"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.iplanet.sso.SSOToken"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.iplanet.sso.SSOTokenManager"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.idm.AMIdentity"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.idm.IdRepoException"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.idm.IdType"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.security.AdminTokenAction"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.console.base.AMViewBeanBase" %>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.workflow.ITask" %>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="com.sun.identity.workflow.WorkflowException" %>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="java.security.AccessController"%>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<%@page import="java.util.*" %>
37ad54b8fd2611b7a4f2b269eec3d27ed784a25dwrowe String locale = request.getParameter("locale");
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Locale resLocale = null;
1e83c8de3aa48b316b28057d53995272baf1260cwrowe if ((locale != null) && (locale.length() > 0)) {
1e83c8de3aa48b316b28057d53995272baf1260cwrowe StringTokenizer st = new StringTokenizer(locale, "|");
94b262d3639149df0b02642a9daa6db8bff58577wrowe if (cnt == 1) {
94b262d3639149df0b02642a9daa6db8bff58577wrowe resLocale = new Locale(st.nextToken());
94b262d3639149df0b02642a9daa6db8bff58577wrowe } else if (cnt == 2) {
94b262d3639149df0b02642a9daa6db8bff58577wrowe resLocale = new Locale(st.nextToken(), st.nextToken());
94b262d3639149df0b02642a9daa6db8bff58577wrowe resLocale = new Locale(st.nextToken(), st.nextToken(),
1e83c8de3aa48b316b28057d53995272baf1260cwrowe resLocale = Locale.US;
1e83c8de3aa48b316b28057d53995272baf1260cwrowe String amadminUUID = null;
1e83c8de3aa48b316b28057d53995272baf1260cwrowe String adminUser = SystemProperties.get(
1e83c8de3aa48b316b28057d53995272baf1260cwrowe if (adminUser != null) {
1e83c8de3aa48b316b28057d53995272baf1260cwrowe SSOToken adminToken = (SSOToken) AccessController.doPrivileged(
1e83c8de3aa48b316b28057d53995272baf1260cwrowe AMIdentity adminUserId = new AMIdentity(adminToken, adminUser,
1e83c8de3aa48b316b28057d53995272baf1260cwrowe IdType.USER, "/", null);
1e83c8de3aa48b316b28057d53995272baf1260cwrowe amadminUUID = adminUserId.getUniversalId();
1e83c8de3aa48b316b28057d53995272baf1260cwrowe SSOTokenManager manager = SSOTokenManager.getInstance();
1e83c8de3aa48b316b28057d53995272baf1260cwrowe SSOToken ssoToken = manager.createSSOToken(request);
1e83c8de3aa48b316b28057d53995272baf1260cwrowe if (!manager.isValidToken(ssoToken)) {
1e83c8de3aa48b316b28057d53995272baf1260cwrowe String redirectUrl = request.getScheme() + "://" +
94b262d3639149df0b02642a9daa6db8bff58577wrowe AMIdentity user = new AMIdentity(ssoToken);
94b262d3639149df0b02642a9daa6db8bff58577wrowe if (!user.getUniversalId().equalsIgnoreCase(amadminUUID)) {
1e83c8de3aa48b316b28057d53995272baf1260cwrowe ResourceBundle rb = null;
1e83c8de3aa48b316b28057d53995272baf1260cwrowe String RB_NAME = "workflowMessages";
1e83c8de3aa48b316b28057d53995272baf1260cwrowe com.sun.identity.shared.debug.Debug.getInstance("workflowMessages");
1e83c8de3aa48b316b28057d53995272baf1260cwrowe rb = ResourceBundle.getBundle(RB_NAME, resLocale);
1e83c8de3aa48b316b28057d53995272baf1260cwrowe String msg = com.sun.identity.shared.locale.Locale.getString(
1e83c8de3aa48b316b28057d53995272baf1260cwrowe throw new RuntimeException(msg);
1e83c8de3aa48b316b28057d53995272baf1260cwrowe } catch (SSOException ssoe) {
1e83c8de3aa48b316b28057d53995272baf1260cwrowe String redirectUrl = request.getScheme() + "://" +
String redirectUrl = request.getScheme() + "://" +
request.getServerName() + ":" +
response.sendRedirect(redirectUrl);
String clazzName = request.getParameter("class");
String redirectUrl = request.getScheme() + "://" +
request.getServerName() + ":" +
response.sendRedirect(redirectUrl);
Class clazz = Class.forName(clazzName);
ITask task = (ITask) clazz.newInstance();
String n = (String) e.nextElement();
map.put("_servlet_context_", getServletConfig().getServletContext());
map.put("_request_", request);
e.getL10NMessage(resLocale)));