Debug.jsp revision e56c51dc995bea71b5992e2b251ad60d0c1fbcf7
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%--
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync The contents of this file are subject to the terms
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync of the Common Development and Distribution License
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync (the License). You may not use this file except in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync compliance with the License.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync You can obtain a copy of the License at
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync https://opensso.dev.java.net/public/CDDLv1.0.html or
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync opensso/legal/CDDLv1.0.txt
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync See the License for the specific language governing
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync permission and limitations under the License.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync When distributing Covered Code, include this CDDL
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Header Notice in each file and include the License file
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync at opensso/legal/CDDLv1.0.txt.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync If applicable, add the following below the CDDL Header,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync with the fields enclosed by brackets [] replaced by
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync your own identifying information:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync "Portions Copyrighted [year] [name of copyright owner]"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync $Id: Debug.jsp,v 1.15 2009/01/28 05:35:06 ww203982 Exp $
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync--%>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%--
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync Portions Copyrighted 2010-2015 ForgeRock AS.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync--%>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%@ page pageEncoding="UTF-8" %>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%@ page
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync import="
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync com.iplanet.sso.SSOToken,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync com.sun.identity.saml2.common.SAML2Constants,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync com.sun.identity.saml2.common.SAML2SDKUtils,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync com.sun.identity.shared.configuration.SystemPropertiesManager,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync com.sun.identity.shared.debug.Debug,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync com.sun.identity.shared.encode.Hash,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.text.MessageFormat,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.ArrayList,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.Collections,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.Enumeration,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.HashMap,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.Iterator,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.List,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.Map,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.MissingResourceException,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync java.util.ResourceBundle,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync org.owasp.esapi.ESAPI"
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync%>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<html xmlns="http://www.w3.org/1999/xhtml">
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<head>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <title>OpenAM</title>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <link rel="stylesheet" type="text/css" href="com_sun_web_ui/css/css_ns6up.css" />
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <link rel="shortcut icon" href="com_sun_web_ui/images/favicon/favicon.ico" type="image/x-icon" />
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync</head>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<body class="DefBdy">
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <div class="SkpMedGry1"><a href="#SkipAnchor3860"><img src="com_sun_web_ui/images/other/dot.gif" alt="Jump to End of Masthead" border="0" height="1" width="1" /></a></div><div class="MstDiv">
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <table class="MstTblBot" title="" border="0" cellpadding="0" cellspacing="0" width="100%">
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <tr>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <td class="MstTdTtl">
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <div class="MstDivTtl"><img name="AMConfig.configurator.ProdName" src="com_sun_web_ui/images/PrimaryProductName.png" alt="OpenAM" border="0" /></div>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync </td>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync </tr>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync </table>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync </div>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <table class="SkpMedGry1" border="0" cellpadding="5" cellspacing="0" width="100%"><tr><td><img src="com_sun_web_ui/images/other/dot.gif" alt="Jump to End of Masthead" border="0" height="1" width="1" /></a></td></tr></table>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync <table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td></td></tr></table>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%@ include file="/WEB-INF/jsp/admincheck.jsp" %>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync SSOToken ssoToken = requireAdminSSOToken(request, response, out, "showServerConfig.jsp");
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync if (ssoToken == null) {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync%>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync</body></html>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync<%
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync }
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync String category = request.getParameter("category");
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync String instance = request.getParameter("instance");
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync String level = request.getParameter("level");
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync String samlDecryptionEnable = request.getParameter("samlDecryptionButton");
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync if (!ESAPI.validator().isValidInput("category", category, "HTTPParameterValue", 512, true)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync || !ESAPI.validator().isValidInput("instance", instance, "HTTPParameterValue", 512, true)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync || !ESAPI.validator().isValidInput("level", level, "HTTPParameterValue", 512, true)) {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync //Invalid values received, let's null them out and ignore them.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync category = null;
instance = null;
level = null;
}
boolean performAction = Boolean.valueOf(request.getParameter("do"));
ResourceBundle resourceBundle = ResourceBundle.getBundle("debug", request.getLocale());
ResourceBundle rbFiles = ResourceBundle.getBundle("debugfiles");
Map categories = new HashMap();
List<String> instances = new ArrayList<String>();
String formToken;
try {
formToken = Hash.hash(ssoToken.getTokenID().toString());
// Make a copy to prevent ConcurrentModificationException
List<Debug> temp = new ArrayList<Debug>(Debug.getInstances());
for (Debug debug : temp) {
if ("SAML2Decrypt".equalsIgnoreCase(debug.getName())) {
continue;
}
instances.add(debug.getName());
}
Collections.sort(instances);
for (Enumeration e = rbFiles.getKeys(); e.hasMoreElements();) {
String key = (String)e.nextElement();
if ("SAML2Decrypt".equalsIgnoreCase(key)) {
continue;
}
String val = rbFiles.getString(key);
List lst = (List) categories.get(val);
if (lst == null) {
lst = new ArrayList();
}
lst.add(key);
categories.put(val, lst);
}
} catch (MissingResourceException e) {
out.println(e.getMessage());
return;
}
if (performAction) {
String receivedToken = request.getParameter("formToken");
if (!formToken.equals(receivedToken)) {
out.println("Invalid form token provided!");
return;
}
if (samlDecryptionEnable != null) {
boolean enable = "Turn ON".equals(samlDecryptionEnable);
SystemPropertiesManager.initializeProperties(SAML2Constants.SAML_DECRYPTION_DEBUG_MODE, Boolean.toString(enable));
Debug.getInstance("SAML2Decrypt").setDebug(enable ? Debug.MESSAGE : Debug.ERROR);
}
}
%>
<table cellpadding=5>
<tr>
<td>
<%
if ((instance == null || instance.length() == 0) && (category == null || category.length() == 0)
|| level == null || level.length() == 0
) {
%>
<form name="frm" action="Debug.jsp" method="POST">
<table>
<tr>
<td>
<%
out.println(resourceBundle.getString("label-category"));
%>
:</td>
<td>
<select name="category">
<%
for (Iterator i = categories.keySet().iterator(); i.hasNext(); ) {
String key = (String)i.next();
out.println("<option>" + key + "</option>");
}
%>
</select>
</td>
<td>&nbsp;&nbsp;</td>
<td>
<%
out.println(resourceBundle.getString("label-level"));
%>
:</td>
<td>
<select name="level">
<%
out.println("<option value=\"1\">" +
resourceBundle.getString("label-level-error") + "</option>");
out.println("<option value=\"2\">" +
resourceBundle.getString("label-level-warning") + "</option>");
out.println("<option value=\"3\">" +
resourceBundle.getString("label-level-message") + "</option>");
%>
</select>
</td>
<td><input type="submit" value="Submit" class="Btn1" onclick="this.form.submit();" onmouseover="javascript: this.className='Btn1Hov'" onmouseout="javascript: this.className='Btn1'" onblur="javascript: javascript: this.className='Btn1'" onfocus="javascript: this.className='Btn1Hov'" />
</td>
</tr>
</table>
</form>
<form name="frm" action="Debug.jsp" method="POST">
<table>
<tr>
<td>
<%
out.println(resourceBundle.getString("label-instance"));
%>
:</td>
<td>
<select name="instance">
<%
for (String inst : instances) {
out.println("<option>" + inst + "</option>");
}
%>
</select>
</td>
<td>&nbsp;&nbsp;</td>
<td>
<%
out.println(resourceBundle.getString("label-level"));
%>
:</td>
<td>
<select name="level">
<%
out.println("<option value=\"1\">" +
resourceBundle.getString("label-level-error") + "</option>");
out.println("<option value=\"2\">" +
resourceBundle.getString("label-level-warning") + "</option>");
out.println("<option value=\"3\">" +
resourceBundle.getString("label-level-message") + "</option>");
%>
</select>
</td>
<td><input type="submit" value="Submit" class="Btn1" onclick="this.form.submit();" onmouseover="javascript: this.className='Btn1Hov'" onmouseout="javascript: this.className='Btn1'" onblur="javascript: javascript: this.className='Btn1'" onfocus="javascript: this.className='Btn1Hov'" />
</td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<table border=1 cellpadding=5 cellspacing=0>
<tr>
<th>
<%
out.println(resourceBundle.getString("label-category"));
%>
</th>
<th>
<%
out.println(resourceBundle.getString("label-filenames"));
%>
</th>
</tr>
<%
for (Iterator i = categories.keySet().iterator(); i.hasNext(); ) {
String key = (String)i.next();
out.println("<tr><td valign=top><b>" + key + "</b></td>");
List values = (List)categories.get(key);
out.println("<td>");
String msg = "message-category-"+key;
try {
msg = resourceBundle.getString("message-category-"+key);
} catch (Exception ex) {}
out.println("<b>"+msg+"</b><br>");
out.print("<span class=\"HlpFldTxt\">");
for (Iterator j = values.iterator(); j.hasNext(); ) {
out.println((String)j.next() + " " );
}
out.print("</span>");
out.println("</td></tr>");
}
%>
</table>
<%
} else {
if (category != null) {
out.println(resourceBundle.getString("label-category") + " = " + category);
if ("Federation".equalsIgnoreCase(category)) {
if (performAction && samlDecryptionEnable == null) {
out.println("<br />");
out.println(resourceBundle.getString("label-saml-decryption-debug") + ": " +
(SAML2SDKUtils.isSAMLDecryptionDebugEnabled() ? "ON" : "OFF"));
out.println("<br />");
}
else {
%>
<br />
<form name="samldecryptiondebug" action="Debug.jsp" method="POST">
<table>
<tr>
<td><%= resourceBundle.getString("label-saml-decryption-debug") %></td>
<td><input type="submit" class="Btn1" name="samlDecryptionButton" value="Turn <%= (SAML2SDKUtils.isSAMLDecryptionDebugEnabled() ? "OFF" : "ON\" onclick=\"return confirm('Enabling this option may result in sensitive data logged to the filesystem. Make sure you disable this option as soon as possible.');") %>" onmouseover="javascript: this.className='Btn1Hov'" onmouseout="javascript: this.className='Btn1'" onblur="javascript: javascript: this.className='Btn1'" onfocus="javascript: this.className='Btn1Hov'" /></td>
<td>
<%
if (performAction) {
out.println(resourceBundle.getString("label-saml-decryption-debug-applied"));
}
%>
</td>
</tr>
</table>
<input type="hidden" name="formToken" value="<%= formToken %>" />
<input type="hidden" name="category" value="<%= category %>" />
<input type="hidden" name="level" value="<%= level %>" />
<input type="hidden" name="do" value="true" />
</form>
<%
}
}
} else {
out.println("Instance" + " = " + instance);
}
out.println("<br />");
String strLevel = "message";
if (level.equals("1")) {
strLevel = "error";
} else if (level.equals("2")) {
strLevel = "warning";
}
out.println(resourceBundle.getString("label-level") + " = " + strLevel);
out.println("<br />");
int levelint = Integer.parseInt(level);
if (category != null) {
Object[] param = {strLevel};
out.println(MessageFormat.format(
resourceBundle.getString("message-setting-level-on-modules"), param));
out.println("<br />");
List values = (List)categories.get(category);
out.println("<ul>");
for (Iterator i = values.iterator(); i.hasNext(); ) {
String mname = (String)i.next();
out.println( "<li>" + mname + "</li>" );
if (performAction && (samlDecryptionEnable == null)) {
Debug debug = Debug.getInstance(mname);
debug.setDebug(levelint);
}
}
out.println("</ul>");
} else {
Object[] param = {strLevel, instance};
out.println(MessageFormat.format(
resourceBundle.getString("message-setting-level-on-instance"), param));
if (performAction) {
Debug.getInstance(instance).setDebug(levelint);
}
}
String backURL = "Debug.jsp";
if (!performAction || (performAction && (samlDecryptionEnable != null))) {
out.println("<form name='frm' method='POST' action='Debug.jsp'>");
if (category != null) {
out.println("<input name='category' type='hidden' value='" + category + "' />");
} else {
out.println("<input name='instance' type='hidden' value='" + instance + "' />");
}
out.println("<input name='level' type='hidden' value='" + levelint + "' />");
out.println("<input name='do' type='hidden' value='true' />");
out.println("<input type='hidden' name='formToken' value='" + formToken + "' />");
out.println("<table border=0>");
out.println("<tr><td>");
out.println("<input type=\"button\" name=\"do\" value=\"" + resourceBundle.getString("button-confirm") + "\" class=\"Btn1\" onclick=\"this.form.submit();\" onmouseover=\"javascript: this.className='Btn1Hov'\" onmouseout=\"javascript: this.className='Btn1'\" onblur=\"javascript: javascript: this.className='Btn1'\" onfocus=\"javascript: this.className='Btn1Hov'\" /></form>");
out.println("</td><td>");
out.println("<input type=\"button\" name=\"back\" value=\"" + resourceBundle.getString("button-back") + "\" class=\"Btn1\" onclick=\"var elements=this.form.elements;for (var i=0;i<elements.length;i++){if(elements[i].type && elements[i].type==='hidden'){elements[i].value=''}};this.form.submit();\" onmouseover=\"javascript: this.className='Btn1Hov'\" onmouseout=\"javascript: this.className='Btn1'\" onblur=\"javascript: this.className='Btn1'\" onfocus=\"javascript: this.className='Btn1Hov'\" />");
out.println("</td></tr></table>");
out.println("</form>");
} else {
Object[] params = {backURL};
out.println("<p>");
out.println(MessageFormat.format(
resourceBundle.getString("message-succeed"), params));
}
}
%>
</td></tr>
</table>
</body>
</html>