ConfigureSocialAuthN.jsp revision 4c2ed873ce0d69780e28220e175a838a6829d4ea
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%--
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ The contents of this file are subject to the terms of the Common Development and
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ Distribution License (the License). You may not use this file except in compliance with the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ specific language governing permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ When distributing Covered Software, include this CDDL Header Notice in each file and include
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ Header, with the fields enclosed by brackets [] replaced by your own identifying
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ information: "Portions copyright [year] [name of copyright owner]".
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ~ Copyright 2014-2015 ForgeRock AS.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster--%>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%@page info="ConfigureSocialAuthN" contentType="text/html;charset=UTF-8" language="java" %>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%@page import="org.owasp.esapi.ESAPI" %>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%@taglib uri="/WEB-INF/jato.tld" prefix="jato" %>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%@taglib uri="/WEB-INF/cc.tld" prefix="cc" %>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%@taglib tagdir="/WEB-INF/tags" prefix="console"%>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<%
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster request.setCharacterEncoding("UTF-8");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster%>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<jato:useViewBean
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster className="com.sun.identity.console.task.ConfigureSocialAuthNViewBean"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fireChildDisplayEvents="true" >
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
f79113ae65937c28690ec71f68f54f862b758baePhill Cunnington <cc:i18nbundle baseName="amConsole" id="amConsole"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <cc:header name="hdrCommon" pageTitle="webconsole.title" bundleID="amConsole" copyrightYear="2014" fireDisplayEvents="true">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <link rel="stylesheet" type="text/css" href="../console/css/openam.css" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <script language="javascript" src="../console/js/am.js"></script>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <script language="javascript" src="../com_sun_web_ui/js/dynamic.js"></script>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <div id="main" style="position: absolute; margin: 0; border: none; padding: 0; width: 100%; height: 101%;">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <cc:form name="ConfigureSocialAuthN" method="post" defaultCommandChild="/btnSearch">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <jato:hidden name="szCache" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <%-- HEADER --%>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <script language="javascript">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster function confirmLogout() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return confirm("<cc:text name="txtLogout" defaultValue="masthead.logoutMessage" bundleID="amConsole"/>");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </script>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <cc:primarymasthead name="mhCommon" bundleID="amConsole" logoutOnClick="return confirmLogout();"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <table border="0" cellpadding="10" cellspacing="0" width="100%">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <tr>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <td>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <cc:alertinline name="ialertCommon" bundleID="amConsole" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </td>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </tr>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </table>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <%-- PAGE CONTENT --%>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <cc:pagetitle name="pgtitle"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bundleID="amConsole"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pageTitleText="page.title.configure.social.authentication"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster showPageTitleSeparator="false"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster viewMenuLabel=""
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster pageTitleHelpMessage="page.desc.configure.social.authentication"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster showPageButtonsTop="true"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster showPageButtonsBottom="false" >
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <cc:propertysheet
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster name="propertyAttributes"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bundleID="amConsole"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster showJumpLinks="false" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </cc:pagetitle>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </cc:form>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </div>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <div id="dlg" class="dvs"></div>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <script type="text/javascript">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!--
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var ajaxObj = getXmlHttpRequestObject();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var userLocale = "<%= viewBean.getUserLocale().toString() %>";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var msgConfiguring = "<p><img src=\"../console/images/processing.gif\" width=\"66\" height\"66\"/></p><cc:text name="txtConfiguring" defaultValue="social.configuration.waiting" bundleID="amConsole" escape="false" />";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 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>";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 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>";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var frm = document.forms['ConfigureSocialAuthN'];
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var btn1 = frm.elements['ConfigureSocialAuthN.button1'];
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster btn1.onclick = submitPage;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var btn2 = frm.elements['ConfigureSocialAuthN.button2'];
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster btn2.onclick = cancelOp;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <%
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String type = request.getParameter("type");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (!ESAPI.validator().isValidInput("Social AuthN Type", type, "HTTPParameterValue", 2000, true)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type = null;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (type != null) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster out.println("var type = \"" + ESAPI.encoder().encodeForHTML(type) + "\";");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster out.println("var type = null;");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster %>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster function submitPage() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster fade();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster document.getElementById('dlg').innerHTML = '<center>' + msgConfiguring + '</center>';
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var url = "../console/ajax/AjaxProxy.jsp";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var params = 'locale=' + userLocale + '&class=com.sun.identity.workflow.ConfigureSocialAuthN' + getData();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ajaxPost(ajaxObj, url, params, configured);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster function cancelOp() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster redirectToXui();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster function getData() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var realm = frm.elements['ConfigureSocialAuthN.tfRealm'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var clientId = frm.elements['ConfigureSocialAuthN.tfClientId'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var clientSecret = frm.elements['ConfigureSocialAuthN.tfClientSecret'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var clientSecretConfirm = frm.elements['ConfigureSocialAuthN.tfConfirmSecret'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var redirectUrl = frm.elements['ConfigureSocialAuthN.tfRedirectUrl'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var params = "&realm=" + escapeEx(realm)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&type=" + escapeEx(type)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&clientId=" + escapeEx(clientId)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&clientSecret=" + escapeEx(clientSecret)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&clientSecretConfirm=" + escapeEx(clientSecretConfirm)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&redirectUrl=" + escapeEx(redirectUrl);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (frm.elements['ConfigureSocialAuthN.tfDiscoveryUrl']) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var discoveryUrl = frm.elements['ConfigureSocialAuthN.tfDiscoveryUrl'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var imageUrl = frm.elements['ConfigureSocialAuthN.tfImageUrl'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var providerName = frm.elements['ConfigureSocialAuthN.tfProviderName'].value;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster params += "&discoveryUrl=" + escapeEx(discoveryUrl)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&imageUrl=" + escapeEx(imageUrl)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster + "&providerName=" + escapeEx(providerName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return params;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster function configured() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (ajaxObj.readyState == 4) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var result = hexToString(ajaxObj.responseText);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var status = result.substring(0, result.indexOf('|'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var result = result.substring(result.indexOf('|') + 1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var msg = '<center><p>' + result + '</p></center>';
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (status == 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msg = msg + '<center>' + msgConfigured + '</center>';
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } else {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msg = msg + '<center>' + closeBtn + '</center>';
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster document.getElementById('dlg').innerHTML = msg;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </script>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <%-- END CONTENT --%>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <console:redirectToXui realm="encodeURIComponent(frm.elements['ConfigureSocialAuthN.tfRealm'].value)"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster xuiPath="../XUI#realms/{realm}/dashboard"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster </cc:header>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster</jato:useViewBean>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster