fedletXACMLResp.jsp revision 9740fa737ef2ed9453ab46d145777dbbbf6a747b
1N/A<%--
1N/A The contents of this file are subject to the terms
1N/A of the Common Development and Distribution License
1N/A (the License). You may not use this file except in
1N/A compliance with the License.
1N/A
1N/A You can obtain a copy of the License at
1N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
1N/A opensso/legal/CDDLv1.0.txt
1N/A See the License for the specific language governing
1N/A permission and limitations under the License.
1N/A
1N/A When distributing Covered Code, include this CDDL
1N/A Header Notice in each file and include the License file
1N/A at opensso/legal/CDDLv1.0.txt.
1N/A If applicable, add the following below the CDDL Header,
1N/A with the fields enclosed by brackets [] replaced by
1N/A your own identifying information:
1N/A "Portions Copyrighted [year] [name of copyright owner]"
1N/A
1N/A Copyright 2009 Sun Microsystems Inc. All Rights Reserved
1N/A--%>
1N/A
1N/A<%--
1N/A Portions Copyrighted 2013 ForgeRock AS
1N/A--%>
1N/A
1N/A
1N/A<%--
1N/A fedletXACMLResp.jsp
1N/A This JSP used by the Fedlet performs the following:
1N/A 1) Retrieves the list of attributes from fedletXACMLQuery.jsp
1N/A 2) Invokes the method to retrieve the policy decision for the Resource URL.
1N/A 3) Displays the Result.
1N/A--%>
1N/A
1N/A<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
1N/A<%@ page import="com.sun.identity.saml2.profile.XACMLQueryUtil" %>
1N/A<%@ page import="org.owasp.esapi.ESAPI" %>
1N/A
1N/A<%
1N/A String deployuri = request.getRequestURI();
1N/A int slashLoc = deployuri.indexOf("/", 1);
1N/A if (slashLoc != -1) {
1N/A deployuri = deployuri.substring(0, slashLoc);
1N/A }
1N/A%>
1N/A
1N/A<html>
1N/A<head>
1N/A <title>Sample Fedlet XACML Query Application</title>
1N/A <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
1N/A <link rel="stylesheet" type="text/css" href="<%= deployuri %>/com_sun_web_ui/css/css_ns6up.css" />
1N/A</head>
1N/A
1N/A<body>
1N/A<div class="MstDiv"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblTop" title="">
1N/A<tbody><tr>
1N/A<td nowrap="nowrap">&nbsp;</td>
1N/A<td nowrap="nowrap">&nbsp;</td>
1N/A</tr></tbody></table>
1N/A
1N/A<table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblBot" title="">
1N/A<tbody><tr>
1N/A<td class="MstTdTtl" width="99%">
1N/A<div class="MstDivTtl"><img name="ProdName" src="<%= deployuri %>/console/images/PrimaryProductName.png" alt="" /></div></td><td class="MstTdLogo" width="1%"><img name="RMRealm.mhCommon.BrandLogo" src="<%= deployuri %>/com_sun_web_ui/images/other/javalogo.gif" alt="Java(TM) Logo" border="0" height="55" width="31" /></td></tr></tbody></table>
1N/A<table class="MstTblEnd" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img name="RMRealm.mhCommon.EndorserLogo" src="<%= deployuri %>/com_sun_web_ui/images/masthead/masthead-sunname.gif" alt="Sun(TM) Microsystems,
1N/AInc." align="right" border="0" height="10" width="108" /></td></tr></tbody></table></div><div class="SkpMedGry1"><a name="SkipAnchor2089" id="SkipAnchor2089"></a></div>
1N/A<div class="SkpMedGry1"><a href="#SkipAnchor4928"><img src="<%= deployuri %>/com_sun_web_ui/images/other/dot.gif" alt="Jump Over Tab Navigation Area. Current Selection is: Access Control" border="0" height="1" width="1" /></a></div>
1N/A
1N/A
1N/A<%
1N/A try {
1N/A String idpEntityID = request.getParameter("idpEntityID");
1N/A if ((idpEntityID == null) ||
1N/A (idpEntityID.length() == 0)) {
1N/A response.sendError(response.SC_BAD_REQUEST,
1N/A SAML2Utils.bundle.getString("nullIDPEntityID"));
1N/A return;
1N/A }
1N/A
1N/A String spEntityID = request.getParameter("spEntityID");
1N/A if ((spEntityID == null) ||
1N/A (spEntityID.length() == 0)) {
1N/A response.sendError(response.SC_BAD_REQUEST,
1N/A SAML2Utils.bundle.getString("nullSPEntityID"));
1N/A return;
1N/A }
1N/A
1N/A String nameIDValue = request.getParameter("nameIDValue");
1N/A String newNameIDValue = nameIDValue.replace("%2F","/");
1N/A
1N/A String resource = request.getParameter("resource");
1N/A if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + resource,
1N/A resource, "HTTPParameterValue", 2000, false)){
1N/A resource = "";
1N/A }
1N/A String action = request.getParameter("action");
1N/A String serviceName = "iPlanetAMWebAgentService";
1N/A
1N/A String policy_decision = XACMLQueryUtil.getPolicyDecisionForFedlet(
1N/A request,
1N/A spEntityID,
1N/A idpEntityID,
1N/A newNameIDValue,
1N/A serviceName,
1N/A resource,
1N/A action);
1N/A
1N/A%>
1N/A<h2> Fedlet XACML Query Response </h2>
1N/A<table border="2" cellspacing="0" cellpadding="7">
1N/A<tr>
1N/A<th>Resource</th>
1N/A<th>Policy Decision</th>
1N/A</tr>
1N/A<%
1N/A if(resource!=null) resource = ESAPI.encoder().encodeForHTML(resource);
1N/A out.println("<tr>");
1N/A out.println("<td>");
out.println(resource);
out.println("</td>");
out.println("<td>");
out.println(policy_decision);
out.println("</td>");
%>
</table>
<%
} catch (Exception ex) {
SAML2Utils.debug.error("Error sending XACML Query " , ex);
}
%>
</body>
</html>