4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts<%--
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay/*
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay*
02b85867be37dad95903d24592f5a8e6f9fb64baPhill Cunnington* Copyright 2012-2014 ForgeRock AS.
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay*
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* The contents of this file are subject to the terms
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* of the Common Development and Distribution License
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* (the License). You may not use this file except in
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* compliance with the License.
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay*
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* You can obtain a copy of the License at
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* http://forgerock.org/license/CDDLv1.0.html
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* See the License for the specific language governing
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* permission and limitations under the License.
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay*
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* When distributing Covered Code, include this CDDL
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* Header Notice in each file and include the License file
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* at http://forgerock.org/license/CDDLv1.0.html
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* If applicable, add the following below the CDDL Header,
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* with the fields enclosed by brackets [] replaced by
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay* your own identifying information:
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts* Portions Copyrighted 2012 [ForgeRock Inc]"
747557977e374069e102d06d5cc267d37e6b9b52Kohei Tamura
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts Portions Copyrighted 2012-2015 ForgeRock AS.
747557977e374069e102d06d5cc267d37e6b9b52Kohei Tamura Portions Copyrighted 2015 Nomura Research Institute, Ltd.
747557977e374069e102d06d5cc267d37e6b9b52Kohei Tamura--%>
747557977e374069e102d06d5cc267d37e6b9b52Kohei Tamura
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<%@ page info="ConfigureOAuth2" language="java" %>
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts<%@ page import="org.owasp.esapi.ESAPI" %>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<%@taglib uri="/WEB-INF/jato.tld" prefix="jato" %>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<%@taglib uri="/WEB-INF/cc.tld" prefix="cc" %>
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts<%@taglib tagdir="/WEB-INF/tags" prefix="console"%>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<%
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay request.setCharacterEncoding("UTF-8");
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay%>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<jato:useViewBean
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay className="com.sun.identity.console.task.ConfigureOAuth2ViewBean"
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay fireChildDisplayEvents="true" >
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<cc:i18nbundle baseName="amConsole" id="amConsole"
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<cc:header name="hdrCommon" pageTitle="webconsole.title" bundleID="amConsole" copyrightYear="2008" fireDisplayEvents="true">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <link rel="stylesheet" type="text/css" href="../console/css/openam.css" />
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <script language="javascript" src="../console/js/am.js"></script>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <script language="javascript" src="../console/js/tasksPage.js"></script>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <script language="javascript" src="../com_sun_web_ui/js/dynamic.js"></script>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <div id="main" style="position: absolute; margin: 0; border: none; padding: 0; width:auto; height:101%;">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <div id="divhelp" style="display: none; position:absolute; margin: 0; border: 1px solid #AABCC8; padding: 0; width:400px; height:200px; background:#FCFCFC">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <table border=0 cellpadding=2 cellspacing=0 width="100%">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <tr><td width=99%><span id="divHelpmsg" /></td>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <td width="1%" valign="top">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <img src="../console/images/tasks/close.gif" width="16" height="16" onClick="hideHelp()" />
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </td>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </tr>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </table>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </div>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <cc:form name="ConfigureOAuth2" method="post">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <jato:hidden name="szCache" />
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <script language="javascript">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay function confirmLogout() {
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay return confirm("<cc:text name="txtLogout" defaultValue="masthead.logoutMessage" bundleID="amConsole"/>");
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay }
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay function cancelOp() {
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts redirectToXui();
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay return false;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay }
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </script>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <cc:primarymasthead name="mhCommon" bundleID="amConsole" logoutOnClick="return confirmLogout();" locale="<%=((com.sun.identity.console.base.AMViewBeanBase)viewBean).getUserLocale()%>"/>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <table border="0" cellpadding="10" cellspacing="0" width="100%">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <tr>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <td>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <cc:alertinline name="ialertCommon" bundleID="amConsole" />
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </td>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </tr>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </table>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <%-- PAGE CONTENT --------------------------------------------------------- --%>
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts <cc:pagetitle name="pgtitle" bundleID="amConsole" showPageTitleSeparator="true" viewMenuLabel="" pageTitleHelpMessage="" showPageButtonsTop="true" showPageButtonsBottom="false" />
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay <cc:propertysheet name="propertyAttributes" bundleID="amConsole" showJumpLinks="false"/>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay </cc:form>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay</cc:header>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay</div>
747557977e374069e102d06d5cc267d37e6b9b52Kohei Tamura<div id="dlg" class="dvs"></div>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts<console:redirectToXui realm="encodeURIComponent(frm.elements['ConfigureOAuth2.tfRealm'].value)"
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts xuiPath="../XUI#realms/{realm}/dashboard"/>
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay<script language="javascript">
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar msgCreating = "<p><img src=\"../console/images/processing.gif\" width=\"66\" height\"66\"/></p><cc:text name="txtConfiguring" defaultValue="configuring.oauth2.waiting" bundleID="amConsole" escape="false" />";
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar ttlCreated = "<h3><cc:text name="txtTtlCreated" defaultValue="oauth2.configured.title" escape="false" bundleID="amConsole" /></h3>";
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpottsvar msgCreated = "<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>";
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar 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>";
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar frm = document.forms['ConfigureOAuth2'];
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar btn1 = frm.elements['ConfigureOAuth2.button1'];
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemaybtn1.onclick = submitPage;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar btn2 = frm.elements['ConfigureOAuth2.button2'];
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemaybtn2.onclick = cancelOp;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar ajaxObj = getXmlHttpRequestObject();
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayvar userLocale = "<%= viewBean.getUserLocale().toString() %>";
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts<%
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts String type = request.getParameter("type");
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts if (!ESAPI.validator().isValidInput("Social AuthN Type", type, "HTTPParameterValue", 2000, true)) {
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts type = null;
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts }
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts if (type != null) {
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts out.println("var type = \"" + ESAPI.encoder().encodeForHTML(type) + "\";");
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts } else {
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts out.println("var type = null;");
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts }
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts%>
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayfunction getData(){
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var realm = frm.elements['ConfigureOAuth2.tfRealm'].value;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var rtl = frm.elements['ConfigureOAuth2.choiceRefreshLifetime'].value;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var acl = frm.elements['ConfigureOAuth2.choiceCodeLifetime'].value;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var atl = frm.elements['ConfigureOAuth2.choiceTokenLifetime'].value;
40b93fa3f473f5b97dea9cc4e1cea0140512de3dJaco Jooste var irt = (frm.elements['ConfigureOAuth2.choiceRefreshToken'].checked == true) ? "true" : "false";
40b93fa3f473f5b97dea9cc4e1cea0140512de3dJaco Jooste var irtr = (frm.elements['ConfigureOAuth2.choiceRefreshTokenOnRefreshing'].checked == true) ? "true" : "false";
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var sic = frm.elements['ConfigureOAuth2.choiceScopeImpl'].value;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay return "&realm=" + escapeEx(realm) +
8b6198b1170e3128c5df83267597f0058d07c70dJames Phillpotts "&type=" + escapeEx(type) +
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay "&rtl=" + escapeEx(rtl) +
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay "&acl=" + escapeEx(acl) +
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay "&atl=" + escapeEx(atl) +
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay "&irt=" + escapeEx(irt) +
02b85867be37dad95903d24592f5a8e6f9fb64baPhill Cunnington "&irtr=" + escapeEx(irtr) +
4dd7bb6f3e8ae36293b5c26de892191cb255a5a3Jason Lemay "&sic=" + escapeEx(sic);
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay}
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayfunction submitPage() {
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay document.getElementById('dlg').style.top = '300px';
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay fade();
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay document.getElementById('dlg').innerHTML = '<center>' +
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay msgCreating + '</center>';
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var url = "../console/ajax/AjaxProxy.jsp";
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var params = 'locale=' + userLocale +
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay '&class=com.sun.identity.workflow.ConfigureOAuth2' + getData();
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay ajaxPost(ajaxObj, url, params, configured);
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay return false;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay}
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemayfunction configured() {
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay if (ajaxObj.readyState == 4) {
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var result = hexToString(ajaxObj.responseText);
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var status = result.substring(0, result.indexOf('|'));
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var result = result.substring(result.indexOf('|') +1);
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay var msg = '<center><p>' + result + '</p></center>';
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay if (status == 0) {
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay msg = '<center>' + ttlCreated + msg + msgCreated + '</center>';
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay } else {
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay msg = msg + '<center>' + closeBtn + '</center>';
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay }
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay document.getElementById('dlg').innerHTML = msg;
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay }
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay}
4c2ed873ce0d69780e28220e175a838a6829d4eaJames Phillpotts
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay</script>
f58c87ece2202b8f85310d8885c7e39a7f435c09Jason Lemay</jato:useViewBean>