a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%--
a78048ccbdb6256da15e6b0e7e95355e480c2301nd The contents of this file are subject to the terms
a78048ccbdb6256da15e6b0e7e95355e480c2301nd of the Common Development and Distribution License
a78048ccbdb6256da15e6b0e7e95355e480c2301nd (the License). You may not use this file except in
a78048ccbdb6256da15e6b0e7e95355e480c2301nd compliance with the License.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd You can obtain a copy of the License at
a78048ccbdb6256da15e6b0e7e95355e480c2301nd https://opensso.dev.java.net/public/CDDLv1.0.html or
a78048ccbdb6256da15e6b0e7e95355e480c2301nd opensso/legal/CDDLv1.0.txt
a78048ccbdb6256da15e6b0e7e95355e480c2301nd See the License for the specific language governing
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen permission and limitations under the License.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen When distributing Covered Code, include this CDDL
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen Header Notice in each file and include the License file
a78048ccbdb6256da15e6b0e7e95355e480c2301nd at opensso/legal/CDDLv1.0.txt.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd If applicable, add the following below the CDDL Header,
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen with the fields enclosed by brackets [] replaced by
3f08db06526d6901aa08c110b5bc7dde6bc39905nd your own identifying information:
a78048ccbdb6256da15e6b0e7e95355e480c2301nd "Portions Copyrighted [year] [name of copyright owner]"
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd $Id: fedletAttrResp.jsp,v 1.2 2009/07/24 22:53:20 madan_ranganath Exp $
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Copyright 2009 Sun Microsystems Inc. All Rights Reserved
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung Portions Copyrighted 2016 ForgeRock AS.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd--%>
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%--
a78048ccbdb6256da15e6b0e7e95355e480c2301nd fedletAttrResp.jsp
a78048ccbdb6256da15e6b0e7e95355e480c2301nd This JSP used by the Fedlet performs the following:
a78048ccbdb6256da15e6b0e7e95355e480c2301nd 1) Retrieves the list of attributes from fedletAttrQuery.jsp
a78048ccbdb6256da15e6b0e7e95355e480c2301nd 2) Invokes the method to retrieve the attribute values
a78048ccbdb6256da15e6b0e7e95355e480c2301nd 3) Displays the attribute value pairs.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd--%>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.shared.debug.Debug" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml.common.SAMLUtils" %>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh<%@ page import="com.sun.identity.saml2.assertion.Assertion" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.assertion.AssertionFactory" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.assertion.Attribute" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.assertion.NameID" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.common.SAML2Constants" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.profile.AttributeQueryUtil" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="com.sun.identity.saml2.protocol.Response" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="java.util.ArrayList" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="java.util.Date" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="java.util.HashMap" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="java.util.Iterator" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="java.util.List" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%@ page import="java.util.Map" %>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String deployuri = request.getRequestURI();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd int slashLoc = deployuri.indexOf("/", 1);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if (slashLoc != -1) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd deployuri = deployuri.substring(0, slashLoc);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd%>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<html>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<head>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <title>Sample Fedlet Attribute Query Application</title>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <link rel="stylesheet" type="text/css" href="<%= deployuri %>/com_sun_web_ui/css/css_ns6up.css" />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd</head>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<body>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<div class="MstDiv"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblTop" title="">
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<tbody><tr>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<td nowrap="nowrap">&nbsp;</td>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<td nowrap="nowrap">&nbsp;</td>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd</tr></tbody></table>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblBot" title="">
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<tbody><tr>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<td class="MstTdTtl" width="99%">
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<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>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<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,
a78048ccbdb6256da15e6b0e7e95355e480c2301ndInc." align="right" border="0" height="10" width="108" /></td></tr></tbody></table></div><div class="SkpMedGry1"><a name="SkipAnchor2089" id="SkipAnchor2089"></a></div>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<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>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%
a78048ccbdb6256da15e6b0e7e95355e480c2301nd try {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String idpEntityID = request.getParameter("idpEntityID");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if ((idpEntityID == null) ||
a78048ccbdb6256da15e6b0e7e95355e480c2301nd (idpEntityID.length() == 0)) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd response.sendError(response.SC_BAD_REQUEST,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd SAML2Utils.bundle.getString("nullIDPEntityID"));
a78048ccbdb6256da15e6b0e7e95355e480c2301nd return;
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String spEntityID = request.getParameter("spEntityID");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if ((spEntityID == null) ||
a78048ccbdb6256da15e6b0e7e95355e480c2301nd (spEntityID.length() == 0)) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd response.sendError(response.SC_BAD_REQUEST,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd SAML2Utils.bundle.getString("nullSPEntityID"));
a78048ccbdb6256da15e6b0e7e95355e480c2301nd return;
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String nameIDValue = request.getParameter("nameidvalue");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String newNameIDValue = nameIDValue.replace("%2F","/");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd AssertionFactory assertionFactory = AssertionFactory.getInstance();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd List attrsList = new ArrayList();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd try {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if (request.getParameter("attr1").length() > 1 |
a78048ccbdb6256da15e6b0e7e95355e480c2301nd request.getParameter("attr2").length() > 1 |
a78048ccbdb6256da15e6b0e7e95355e480c2301nd request.getParameter("attr3").length() > 1) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if (request.getParameter("attr1").length() > 1) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd attrsList.add(request.getParameter("attr1"));
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if (request.getParameter("attr2").length() > 1) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd attrsList.add(request.getParameter("attr2"));
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd if (request.getParameter("attr3").length()>1) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd attrsList.add(request.getParameter("attr3"));
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd } catch (Exception e){
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.print("Requesting all available IDP attributes");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String attrQueryProfile = request.getParameter("attrQueryProfile");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String subjectDN = request.getParameter("subjectDN");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Map attrMap = AttributeQueryUtil.getAttributeMapForFedlet(
a78048ccbdb6256da15e6b0e7e95355e480c2301nd spEntityID,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd idpEntityID,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd newNameIDValue,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd attrsList,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd attrQueryProfile,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd subjectDN);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
a78048ccbdb6256da15e6b0e7e95355e480c2301nd%>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<h2> Fedlet Attribute Query Response </h2>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<table border="2" cellspacing="0" cellpadding="7">
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<tr>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<th>Attribute Query</th>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<th>Attribute Response</th>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd</tr>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Iterator itr = attrMap.entrySet().iterator();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd while (itr.hasNext()) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Map.Entry pairs = (Map.Entry)itr.next();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println("<tr>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println("<td>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String attrKey = (String)pairs.getKey();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println(attrKey + "<br>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println("</td>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println("<td>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd String attrValue = (String)pairs.getValue();
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println(attrValue + "<br>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println("</td>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd out.println("</tr>");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd%>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd</table>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<%
a78048ccbdb6256da15e6b0e7e95355e480c2301nd } catch (Exception ex) {
a78048ccbdb6256da15e6b0e7e95355e480c2301nd SAML2Utils.debug.error("Error sending AttributeQuery " , ex);
a78048ccbdb6256da15e6b0e7e95355e480c2301nd }
a78048ccbdb6256da15e6b0e7e95355e480c2301nd%>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd</body>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd</html>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd