1056N/A<%--
1056N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1276N/A
1276N/A Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
1276N/A
1276N/A The contents of this file are subject to the terms
1276N/A of the Common Development and Distribution License
1276N/A (the License). You may not use this file except in
1276N/A compliance with the License.
1276N/A
1276N/A You can obtain a copy of the License at
1276N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
1276N/A opensso/legal/CDDLv1.0.txt
1276N/A See the License for the specific language governing
1276N/A permission and limitations under the License.
1276N/A
1276N/A When distributing Covered Code, include this CDDL
1276N/A Header Notice in each file and include the License file
1276N/A at opensso/legal/CDDLv1.0.txt.
1276N/A If applicable, add the following below the CDDL Header,
1276N/A with the fields enclosed by brackets [] replaced by
1276N/A your own identifying information:
1276N/A "Portions Copyrighted [year] [name of copyright owner]"
1276N/A
1276N/A $Id: CreateRemoteIDP.jsp,v 1.9 2009/07/20 23:03:23 asyhuang Exp $
1276N/A
1276N/A Portions Copyrighted 2012-2015 ForgeRock AS.
1276N/A--%>
1276N/A
1276N/A<%@ page info="CreateRemoteIDP" language="java" %>
1276N/A<%@taglib uri="/WEB-INF/jato.tld" prefix="jato" %>
1276N/A<%@taglib uri="/WEB-INF/cc.tld" prefix="cc" %>
1276N/A<%@taglib tagdir="/WEB-INF/tags" prefix="console"%>
1276N/A<%
1276N/A request.setCharacterEncoding("UTF-8");
1276N/A%>
1276N/A<jato:useViewBean
1276N/A className="com.sun.identity.console.task.CreateRemoteIDPViewBean"
1276N/A fireChildDisplayEvents="true" >
1276N/A
1276N/A<cc:i18nbundle baseName="amConsole" id="amConsole"
1276N/A locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
1276N/A
1276N/A<cc:header name="hdrCommon" pageTitle="webconsole.title" bundleID="amConsole" copyrightYear="2008" fireDisplayEvents="true">
1276N/A
1276N/A<link rel="stylesheet" type="text/css" href="../console/css/openam.css" />
1276N/A<script language="javascript" src="../console/js/am.js"></script>
1276N/A<script language="javascript" src="../console/js/tasksPage.js"></script>
1276N/A<script language="javascript" src="../com_sun_web_ui/js/dynamic.js"></script>
1276N/A
1276N/A<div id="main" style="position: absolute; margin: 0; border: none; padding: 0; width:auto; height:101%;">
1276N/A
1276N/A<div id="divhelp" style="display: none; position:absolute; margin: 0; border: 1px solid #AABCC8; padding: 0; width:400px; height:200px; background:#FCFCFC">
1276N/A<table border=0 cellpadding=2 cellspacing=0 width="100%">
1276N/A<tr><td width=99%><span id="divHelpmsg" /></td>
1276N/A<td width="1%" valign="top">
1276N/A<img src="../console/images/tasks/close.gif" width="16" height="16" onClick="hideHelp()" />
1276N/A</td>
1276N/A</tr>
1276N/A</table>
1276N/A</div>
1276N/A
1276N/A<cc:form name="CreateRemoteIDP" method="post">
1276N/A<jato:hidden name="szCache" />
1276N/A<script language="javascript">
1276N/A function confirmLogout() {
1276N/A return confirm("<cc:text name="txtLogout" defaultValue="masthead.logoutMessage" bundleID="amConsole"/>");
1276N/A }
1276N/A
1276N/A function openWindow(fieldName) {
1276N/A selectWin = window.open('../federation/FileUploader', fieldName,
1276N/A 'height=300,width=650,top=' +
1276N/A ((screen.height-(screen.height/2))-(500/2)) +
1276N/A ',left=' + ((screen.width-650)/2));
1276N/A selectWin.focus();
1276N/A }
1276N/A
1276N/A function metaOptionSelect(radio) {
1276N/A if (radio.value == 'url') {
1276N/A frm.elements['CreateRemoteIDP.tfMetadataFileURL'].style.display = '';
1276N/A frm.elements['CreateRemoteIDP.btnMetadata'].style.display = 'none';
1276N/A } else {
1276N/A frm.elements['CreateRemoteIDP.tfMetadataFileURL'].style.display = 'none';
1276N/A frm.elements['CreateRemoteIDP.btnMetadata'].style.display = '';
1276N/A }
1276N/A }
1276N/A
1276N/A function cancelOp() {
1276N/A redirectToXui();
1276N/A return false;
1276N/A }
1276N/A
1276N/A function realmSelect(radio) {
1276N/A getCircleOfTrust(radio.value);
1276N/A }
1276N/A
1276N/A function cotOptionSelect(radio) {
1276N/A var ans = radio.value;
1276N/A if (ans == 'yes') {
1276N/A document.getElementById('cotchoice').style.display = 'block';
1276N/A document.getElementById('cottf').style.display = 'none';
1276N/A frm.elements['CreateRemoteIDP.tfCOT'].value = '';
1276N/A } else {
1276N/A document.getElementById('cotchoice').style.display = 'none';
1276N/A document.getElementById('cottf').style.display = 'block';
1276N/A }
1276N/A }
1276N/A
1276N/A function hideRealm() {
1276N/A var frm = document.forms['CreateRemoteIDP'];
1276N/A var realmobj = frm.elements['CreateRemoteIDP.tfRealm'];
1276N/A if (realmobj.options.length < 2) {
1276N/A hideRealmObjs();
1276N/A }
1276N/A }
1276N/A
1276N/A function hideRealmObjs() {
1276N/A document.getElementById('realmlbl').style.display = 'none';
1276N/A document.getElementById('realmfld').style.display = 'none';
1276N/A }
1276N/A
1276N/A</script>
1276N/A
1276N/A<console:redirectToXui realm="encodeURIComponent(frm.elements['CreateRemoteIDP.tfRealm'].value)"
1276N/A xuiPath="../XUI#realms/{realm}/dashboard"/>
1276N/A
1276N/A <cc:primarymasthead name="mhCommon" bundleID="amConsole" logoutOnClick="return confirmLogout();" locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
1276N/A<table border="0" cellpadding="10" cellspacing="0" width="100%">
1276N/A <tr>
1276N/A <td>
1276N/A <cc:alertinline name="ialertCommon" bundleID="amConsole" />
1276N/A </td>
1276N/A </tr>
1276N/A</table>
1276N/A
1276N/A<%-- PAGE CONTENT --------------------------------------------------------- --%>
1276N/A<cc:pagetitle name="pgtitle" bundleID="amConsole" pageTitleText="page.title.configure.remote.idp" showPageTitleSeparator="true" viewMenuLabel="" pageTitleHelpMessage="" showPageButtonsTop="true" showPageButtonsBottom="false" />
1276N/A
1276N/A<table border="0" cellpadding="20" cellspacing="0">
1276N/A<tr><td>
1276N/A <cc:text name="txtDesc" defaultValue="page.desc.configure.remote.idp" bundleID="amConsole" />
1276N/A</td></tr>
1276N/A</table>
1276N/A
1276N/A
1276N/A<cc:propertysheet name="propertyAttributes" bundleID="amConsole" showJumpLinks="false"/>
1276N/A
1276N/A</cc:form>
1276N/A</cc:header>
1276N/A</div>
1276N/A<div id="dlg" class="dvs"></div>
1276N/A
1276N/A<script language="javascript">
1276N/A hideRealm();
1276N/A
1276N/A var msgConfiguring = "<cc:text name="txtConfiguring" defaultValue="configure.provider.waiting" bundleID="amConsole" escape="false" />";
1276N/A
1276N/A var msgConfigured = "<p>&nbsp;</p><input name=\"btnOK\" type=\"submit\" class=\"Btn1\" value=\"<cc:text name="txtOKBtn" defaultValue="ajax.ok.button" bundleID="amConsole" />\" onClick=\"redirectToXui();return false;\" /></div></p>";
1276N/A var closeBtn = "<p>&nbsp;</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>";
1276N/A
1276N/A var frm = document.forms['CreateRemoteIDP'];
1276N/A var btn1 = frm.elements['CreateRemoteIDP.button1'];
1276N/A btn1.onclick = submitPage;
1276N/A var btn2 = frm.elements['CreateRemoteIDP.button2'];
1276N/A btn2.onclick = cancelOp;
1276N/A var ajaxObj = getXmlHttpRequestObject();
1276N/A var userLocale = "<%= viewBean.getUserLocale().toString() %>";
1276N/A
1276N/A function submitPage() {
1276N/A fade();
1276N/A document.getElementById('dlg').innerHTML = '<center>' +
1276N/A msgConfiguring + '</center>';
1276N/A var url = "../console/ajax/AjaxProxy.jsp";
1276N/A var params = 'locale=' + userLocale +
1276N/A '&class=com.sun.identity.workflow.CreateRemoteIDP' + getData();
1276N/A ajaxPost(ajaxObj, url, params, configured);
1276N/A return false;
1276N/A }
1276N/A
1276N/A function getData() {
1276N/A var cot;
1276N/A var cotRadio = getRadioVal(frm, 'CreateRemoteIDP.radioCOT');
1276N/A if (cotRadio == "yes") {
1276N/A cot = frm.elements['CreateRemoteIDP.choiceCOT'].value;
1276N/A } else {
1276N/A cot = frm.elements['CreateRemoteIDP.tfCOT'].value;
1276N/A }
1276N/A
1276N/A var realm = frm.elements['CreateRemoteIDP.tfRealm'].value;
1276N/A var metaRadio = getRadioVal(frm, 'CreateRemoteIDP.radioMeta');
1276N/A var meta = (metaRadio == 'url') ?
1276N/A frm.elements['CreateRemoteIDP.tfMetadataFileURL'].value :
1276N/A frm.elements['CreateRemoteIDP.tfMetadataFile'].value;
1276N/A
1276N/A return "&metadata=" + escapeEx(meta) +
1276N/A "&realm=" + escapeEx(realm) +
1276N/A "&cot=" + escapeEx(cot);
1276N/A }
1276N/A
1276N/A function configured() {
1276N/A if (ajaxObj.readyState == 4) {
1276N/A var result = hexToString(ajaxObj.responseText);
1276N/A var status = result.substring(0, result.indexOf('|'));
1276N/A var result = result.substring(result.indexOf('|') +1);
1276N/A var msg = '<center><p>' + result + '</p></center>';
1276N/A if (status == 0) {
1276N/A msg = msg + '<center>' + msgConfigured + '</center>';
1276N/A } else {
1276N/A msg = msg + '<center>' + closeBtn + '</center>';
1276N/A }
1276N/A document.getElementById('dlg').innerHTML = msg;
1276N/A }
1276N/A }
1276N/A
1276N/A function getCircleOfTrust(realm) {
1276N/A var url = "../console/ajax/AjaxProxy.jsp";
1276N/A var params = 'locale=' + userLocale +
1276N/A '&class=com.sun.identity.workflow.GetCircleOfTrusts' +
1276N/A '&realm=' + escapeEx(realm);
1276N/A ajaxPost(ajaxObj, url, params, circleOfTrust);
1276N/A }
1276N/A
1276N/A function circleOfTrust() {
1276N/A if (ajaxObj.readyState == 4) {
1276N/A var result = hexToString(ajaxObj.responseText);
1276N/A var status = result.substring(0, result.indexOf('|'));
1276N/A var result = result.substring(result.indexOf('|') +1);
1276N/A var msg = '';
1276N/A if (status == 0) {
1276N/A document.getElementById('cotsection').style.display = 'block';
1276N/A result = result.replace(/^\s+/, '');
1276N/A result = result.replace(/\s+$/, '');
1276N/A if (result.length == 0) {
1276N/A document.getElementById('cotq').style.display = 'none';
1276N/A document.getElementById('cotchoice').style.display = 'none';
1276N/A document.getElementById('cottf').style.display = 'block';
1276N/A chooseRadio(frm, 'CreateRemoteIDP.radioCOT', 'no');
1276N/A } else {
1276N/A var cots = result.split('|');
1276N/A var choiceCOT = frm.elements['CreateRemoteIDP.choiceCOT'];
1276N/A for (var i = 0; i < cots.length; i++) {
1276N/A var decodedCOT = decodeURIComponent(cots[i]);
1276N/A choiceCOT.options[i] = new Option(decodedCOT,
1276N/A decodedCOT);
1276N/A }
1276N/A document.getElementById('cotq').style.display = 'block';
1276N/A document.getElementById('cotchoice').style.display = 'block';
1276N/A document.getElementById('cottf').style.display = 'none';
1276N/A chooseRadio(frm, 'CreateRemoteIDP.radioCOT', 'yes');
1276N/A }
1276N/A focusMain();
1276N/A if (presetcot) {
1276N/A selectOption(frm, 'CreateRemoteIDP.choiceCOT', presetcot);
1276N/A presetcot = null;
1276N/A }
1276N/A } else {
1276N/A msg = '<center><p>' + result + '</p></center>';
1276N/A msg = msg + '<center>' + closeBtn + '</center>';
1276N/A document.getElementById('dlg').innerHTML = msg;
1276N/A document.getElementById('cotsection').style.display = 'none';
1276N/A ajaxObj = getXmlHttpRequestObject();
1276N/A }
1276N/A }
1276N/A }
1276N/A
1276N/A frm.elements['CreateRemoteIDP.btnMetadata'].style.display = 'none';
1276N/A var presetcot = frm.elements['CreateRemoteIDP.tfCOT'].value;
1276N/A
1276N/A<%
1276N/A String cot = request.getParameter("cot");
1276N/A if ((cot != null) && (cot.trim().length() > 0)) {
1276N/A out.println("hideRealmObjs();");
1276N/A out.println("document.getElementById('cotsection').style.display = 'none';");
1276N/A } else {
1276N/A out.println("getCircleOfTrust('/');");
1276N/A }
1276N/A
1276N/A%>
1276N/A
1276N/A function unescapeQuote(str) {
1276N/A str = str.replace(/&quot;/g, '"');
1276N/A str = str.replace(/&lt;/g, '<');
1276N/A str = str.replace(/&gt;/g, '>');
1276N/A return str;
1276N/A }
1276N/A
1276N/A var infoRealm = unescapeQuote("<cc:text name="txtInfoRealm" defaultValue="configure.provider.help.realm" bundleID="amConsole" />");
1276N/A var infoMetadataFile = unescapeQuote("<cc:text name="txtInfoMetadataFile" defaultValue="configure.provider.help.metadata" bundleID="amConsole" />");
1276N/A var infoMetadataFileURL = unescapeQuote("<cc:text name="txtInfoMetadataFileURL" defaultValue="configure.provider.help.metadataurl" bundleID="amConsole" />");
1276N/A</script>
1276N/A
1276N/A</jato:useViewBean>
1276N/A