ConfigureGoogleApps.jsp revision 747557977e374069e102d06d5cc267d37e6b9b52
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync The contents of this file are subject to the terms
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync of the Common Development and Distribution License
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (the License). You may not use this file except in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync compliance with the License.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync You can obtain a copy of the License at
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync https://opensso.dev.java.net/public/CDDLv1.0.html or
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync See the License for the specific language governing
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync permission and limitations under the License.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync When distributing Covered Code, include this CDDL
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Header Notice in each file and include the License file
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync If applicable, add the following below the CDDL Header,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync with the fields enclosed by brackets [] replaced by
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync your own identifying information:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync "Portions Copyrighted [year] [name of copyright owner]"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync $Id: ConfigureGoogleApps.jsp,v 1.8 2009/08/14 18:32:46 asyhuang Exp $
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Portions Copyrighted 2013-2015 ForgeRock AS.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Portions Copyrighted 2015 Nomura Research Institute, Ltd.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<%@ page import="org.owasp.esapi.ESAPI"%>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<%@ page info="CreateGoogleApps" language="java" %>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<%@taglib uri="/WEB-INF/jato.tld" prefix="jato" %>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<%@taglib uri="/WEB-INF/cc.tld" prefix="cc" %>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<jato:useViewBean
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync className="com.sun.identity.console.task.ConfigureGoogleAppsViewBean"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync fireChildDisplayEvents="true" >
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<cc:i18nbundle baseName="amConsole" id="amConsole"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<cc:header name="hdrCommon" pageTitle="webconsole.title" bundleID="amConsole" copyrightYear="2009" fireDisplayEvents="true">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<link rel="stylesheet" type="text/css" href="../console/css/openam.css" />
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<script language="javascript" src="../console/js/am.js"></script>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<script language="javascript" src="../console/js/tasksPage.js"></script>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<script language="javascript" src="../com_sun_web_ui/js/dynamic.js"></script>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<div id="main" style="position: absolute; margin: 0; border: none; padding: 0; width:auto; height:101%;">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<div id="divhelp" style="display: none; position:absolute; margin: 0; border: 1px solid #AABCC8; padding: 0; width:400px; height:200px; background:#FCFCFC">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<table border=0 cellpadding=2 cellspacing=0 width="100%">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<tr><td width=99%><span id="divHelpmsg" /></td>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<td width="1%" valign="top">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<img src="../console/images/tasks/close.gif" width="16" height="16" onClick="hideHelp()" />
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<cc:form name="ConfigureGoogleApps" method="post">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<jato:hidden name="szCache" />
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<script language="javascript">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function confirmLogout() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync return confirm("<cc:text name="txtLogout" defaultValue="masthead.logoutMessage" bundleID="amConsole"/>");
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function cancelOp() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync return false;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function realmSelect(radio) {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync hideCOTObjs();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync hideIDPObjs();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync getCircleOfTrust(radio.value);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var choiceCOT = frm.elements['ConfigureGoogleApps.choiceCOT'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function cotSelect(radio) {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var idpobj = frm.elements['ConfigureGoogleApps.choiceIDP'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync showIDPObjs();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function hideRealm() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var frm = document.forms['ConfigureGoogleApps'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var realmobj = frm.elements['ConfigureGoogleApps.tfRealm'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync hideRealmObjs();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var cotobj = frm.elements['ConfigureGoogleApps.choiceCOT'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('cotfld').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('cottxt').innerHTML = cotobj.value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var idpobj = frm.elements['ConfigureGoogleApps.choiceIDP'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('idpfld').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('idptxt').innerHTML = idpobj.value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function hideRealmObjs() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('realmlbl').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('realmfld').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function showCOTObjs() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('cotlbl').style.display = '';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('cotfld').style.display = '';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function hideCOTObjs() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('cotlbl').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('cotfld').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function showIDPObjs() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('idplbl').style.display = '';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('idpfld').style.display = '';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function hideIDPObjs() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('idplbl').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('idpfld').style.display = 'none';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<cc:primarymasthead name="mhCommon" bundleID="amConsole" logoutOnClick="return confirmLogout();" locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<table border="0" cellpadding="10" cellspacing="0" width="100%">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync <cc:alertinline name="ialertCommon" bundleID="amConsole" />
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<%-- PAGE CONTENT --------------------------------------------------------- --%>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<cc:pagetitle name="pgtitle" bundleID="amConsole" pageTitleText="page.title.configure.google.apps" showPageTitleSeparator="true" viewMenuLabel="" pageTitleHelpMessage="" showPageButtonsTop="true" showPageButtonsBottom="false" />
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<table border="0" cellpadding="20" cellspacing="0">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync <cc:text name="txtDesc" defaultValue="page.desc.configure.google.apps" bundleID="amConsole" />
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<cc:propertysheet name="propertyAttributes" bundleID="amConsole" showJumpLinks="false"/>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync</cc:header>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<div id="dlg" class="dvs"></div>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync<script language="javascript">
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var frm = document.forms['ConfigureGoogleApps'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var idpNew = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var realmNew = frm.elements['ConfigureGoogleApps.tfRealm'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var domainIdNew ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var msgCreating = "<p><img src=\"../console/images/processing.gif\" width=\"66\" height\"66\"/></p><cc:text name="txtConfiguring" defaultValue="configuring.google.apps.waiting" bundleID="amConsole" escape="false" />";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var msgCreated = "<p> </p><input name=\"btnOK\" type=\"submit\" class=\"Btn1\" value=\"<cc:text name="txtOKBtn" defaultValue="ajax.ok.button" bundleID="amConsole" />\" onClick=\"document.location.replace(\'../task/ConfigureGoogleAppsComplete?idp=\' + idpNew + \'&realm=\' + realmNew + \'&domainId=\' + domainIdNew);return false;\" /></div></p>";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var ttlCreated = "<h3><cc:text name="txtTtlCreated" defaultValue="google.apps.configured.msg" escape="false" bundleID="amConsole" /></h3>";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var closeBtn = "<p> </p><p><div class=\"TtlBtnDiv\"><input name=\"btnClose\" type=\"submit\" class=\"Btn1\" value=\"<cc:text name="txtCloseBtn" defaultValue="ajax.close.button" bundleID="amConsole" />\" onClick=\"focusMain();return false;\" /></div></p>";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var btn1 = frm.elements['ConfigureGoogleApps.button1'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync btn1.onclick = submitPage;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var btn2 = frm.elements['ConfigureGoogleApps.button2'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var ajaxObj = getXmlHttpRequestObject();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var selectOptionCache;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var userLocale = "<%= viewBean.getUserLocale().toString() %>";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function submitPage() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('dlg').style.top = '300px';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('dlg').innerHTML = '<center>' +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync msgCreating + '</center>';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var params = 'locale=' + userLocale +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync '&class=com.sun.identity.workflow.ConfigureGoogleApps' + getData();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync frm = document.forms['ConfigureGoogleApps'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync idpNew = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync realmNew = frm.elements['ConfigureGoogleApps.tfRealm'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var size = frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].length ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync domainIdNew="";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync for (i=0;i<size-1;i++)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync domainIdNew += frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].options[i].value + "," ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ajaxPost(ajaxObj, url, params, configured);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync return false;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function getData() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var cot = frm.elements['ConfigureGoogleApps.choiceCOT'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var idp = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var realm = frm.elements['ConfigureGoogleApps.tfRealm'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var size = frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].length ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync domainIdNew="";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync for (i=0;i<size-1;i++)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync domainIdNew += frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].options[i].value + "," ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync return "&realm=" + escapeEx(realm) +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync "&cot=" + escapeEx(cot) +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync "&idp=" + escapeEx(idp) +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync "&domainId=" + escapeEx(domainIdNew);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function configured() {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var result = hexToString(ajaxObj.responseText);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var status = result.substring(0, result.indexOf('|'));
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var result = result.substring(result.indexOf('|') +1);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var msg = '<center><p>' + result + '</p></center>';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync if (status == 0) {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync msg = '<center>' + ttlCreated + msgCreated + '</center>';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync msg = msg + '<center>' + closeBtn + '</center>';
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync frm = document.forms['ConfigureGoogleApps'];
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync idpNew = frm.elements['ConfigureGoogleApps.choiceIDP'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync realmNew = frm.elements['ConfigureGoogleApps.tfRealm'].value;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var size = frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].length ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync i=0; domainIdNew="";
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync for (i=0;i<size-1;i++)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync domainIdNew += frm.elements['ConfigureGoogleApps.tfDomainId.listbox'].options[i].value + "," ;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync document.getElementById('dlg').innerHTML = msg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync function getCircleOfTrust(realm) {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync var params = 'locale=' + userLocale +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync '&class=com.sun.identity.workflow.GetCircleOfTrusts' +
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync '&realm=' + escapeEx(realm);
clearOptions(frm, 'ConfigureGoogleApps.choiceIDP');
var url = "../console/ajax/AjaxProxy.jsp";
'&class=com.sun.identity.workflow.GetHostedIDPs' +
if (ajaxObj.readyState == 4) {
var result = hexToString(ajaxObj.responseText);
result = result.replace(/^\s+/, '');
result = result.replace(/\s+$/, '');
if (result.length == 0) {
var cots = result.split('|');
for (var i = choiceCOT.length - 1; i>=0; i--) {
choiceCOT.remove(i);
for (var i = 0; i < cots.length; i++) {
choiceCOT.options[i] = new Option(cots[i], cots[i]);
selectOption(frm, 'ConfigureGoogleApps.choiceCOT', presetcot);
document.getElementById('dlg').innerHTML = msg;
if (ajaxObj.readyState == 4) {
var result = hexToString(ajaxObj.responseText);
result = result.replace(/^\s+/, '');
result = result.replace(/\s+$/, '');
if (result.length == 0) {
var idps = result.split('|');
for (var i = 0; i < idps.length; i++) {
choiceIDP.options[i] = new Option(idps[i], idps[i]);
document.getElementById('dlg').innerHTML = msg;
var nodes = document.getElementsByTagName("table");
var len = nodes.length;
String cot = request.getParameter("cot");
if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + cot , cot,
String idp = request.getParameter("entityId");
if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + idp, idp ,
if ((cot != null) && (cot.trim().length() > 0)) {
out.println("hideRealmObjs();");
out.println("hideIDPObjs();");
out.println("document.getElementById('cottxt').innerHTML = \"" + ESAPI.encoder().encodeForHTML(cot) + "\";");
out.println("document.getElementById('idptxt').innerHTML = \"" + ESAPI.encoder().encodeForHTML(idp) + "\";");
out.println("hideRealm();");
str = str.replace(/"/g, '"');
str = str.replace(/</g, '<');
str = str.replace(/>/g, '>');
var infoRealm = unescapeQuote("<cc:text name="txtInfoRealm" defaultValue="configure.google.apps.help.realm" bundleID="amConsole" />");
var infoEntityId = unescapeQuote("<cc:text name="txtInfoEntityId" defaultValue="configure.google.apps.help.entity.id" bundleID="amConsole" />");