fedletAttrQuery.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
165N/A<%--
165N/A The contents of this file are subject to the terms
165N/A of the Common Development and Distribution License
165N/A (the License). You may not use this file except in
165N/A compliance with the License.
165N/A
165N/A You can obtain a copy of the License at
165N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
165N/A opensso/legal/CDDLv1.0.txt
165N/A See the License for the specific language governing
165N/A permission and limitations under the License.
165N/A
165N/A When distributing Covered Code, include this CDDL
165N/A Header Notice in each file and include the License file
165N/A at opensso/legal/CDDLv1.0.txt.
165N/A If applicable, add the following below the CDDL Header,
165N/A with the fields enclosed by brackets [] replaced by
165N/A your own identifying information:
165N/A "Portions Copyrighted [year] [name of copyright owner]"
165N/A
165N/A $Id: fedletAttrQuery.jsp,v 1.3 2009/11/17 07:08:30 sean_brydon Exp $
3817N/A
165N/A Copyright 2009 Sun Microsystems Inc. All Rights Reserved
165N/A
165N/A--%>
165N/A
1627N/A<%--
2854N/A fedletAttrQuery.jsp
2456N/A This JSP used by the Fedlet is to get the list of attributes from IDP
165N/A--%>
165N/A
844N/A<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
1627N/A<%@ page import="com.sun.identity.saml2.jaxb.metadata.IDPSSODescriptorElement" %>
165N/A<%@ page import="com.sun.identity.saml2.jaxb.metadata.SingleSignOnServiceElement" %>
1258N/A<%@ page import="com.sun.identity.saml2.meta.SAML2MetaException" %>
165N/A<%@ page import="com.sun.identity.saml2.meta.SAML2MetaManager" %>
3817N/A<%@ page import="com.sun.identity.shared.encode.URLEncDec" %>
3817N/A<%@ page import="java.io.IOException" %>
3817N/A<%@ page import="java.io.File" %>
165N/A<%@ page import="java.io.InputStream" %>
2456N/A<%@ page import="java.io.FileOutputStream" %>
2456N/A<%@ page import="java.util.ArrayList" %>
2456N/A<%@ page import="java.util.Iterator" %>
165N/A<%@ page import="java.util.List" %>
165N/A<%@ page import="java.util.Map" %>
1627N/A<%@ page import="java.util.Set" %>
165N/A<%@ page import="org.owasp.esapi.ESAPI" %>
165N/A
165N/A<%@ page import="com.sun.identity.cot.CircleOfTrustManager" %>
165N/A<%@ page import="com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement" %>
165N/A
165N/A<script>
165N/Afunction enableSubjectDN() {
165N/A
165N/A for (var i=0; i < document.fedletAttrQuery.attrQueryProfile.length; i++) {
165N/A if (document.fedletAttrQuery.attrQueryProfile[i].checked) {
165N/A var rad_val = document.fedletAttrQuery.attrQueryProfile[i].value;
165N/A if (rad_val == "x509Subject") {
165N/A document.fedletAttrQuery.subjectDN.disabled=false;
165N/A } else {
165N/A document.fedletAttrQuery.subjectDN.disabled=true;
165N/A }
165N/A }
165N/A }
165N/A return true;
165N/A}
165N/A
165N/Afunction checkEmptySubjectDN() {
165N/A for (var i=0; i < document.fedletAttrQuery.attrQueryProfile.length; i++) {
165N/A if (document.fedletAttrQuery.attrQueryProfile[i].checked) {
165N/A var rad_val = document.fedletAttrQuery.attrQueryProfile[i].value;
165N/A if (rad_val == "x509Subject") {
165N/A if (document.fedletAttrQuery.subjectDN.value == "") {
165N/A alert("X.509 Subject DN cannot be empty");
165N/A return false;
165N/A }
165N/A }
165N/A }
165N/A }
165N/A return true;
165N/A}
165N/A</script>
165N/A<%
165N/A String deployuri = request.getRequestURI();
165N/A int slashLoc = deployuri.indexOf("/", 1);
165N/A if (slashLoc != -1) {
165N/A deployuri = deployuri.substring(0, slashLoc);
165N/A }
165N/A String fedletHomeDir = System.getProperty("com.sun.identity.fedlet.home");
165N/A if ((fedletHomeDir == null) || (fedletHomeDir.trim().length() == 0)) {
165N/A if (System.getProperty("user.home").equals(File.separator)) {
165N/A fedletHomeDir = File.separator + "fedlet";
165N/A } else {
165N/A fedletHomeDir = System.getProperty("user.home") +
165N/A File.separator + "fedlet";
165N/A }
165N/A }
165N/A
3477N/A%>
3477N/A<html>
165N/A<head>
165N/A <title>Attribute Query</title>
165N/A <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
165N/A <link rel="stylesheet" type="text/css" href="<%= deployuri %>/com_sun_web_ui/css/css_ns6up.css" />
165N/A</head>
165N/A
165N/A<body>
165N/A<div class="MstDiv"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblTop" title="">
165N/A<tbody><tr>
165N/A<td nowrap="nowrap">&nbsp;</td>
165N/A<td nowrap="nowrap">&nbsp;</td>
165N/A</tr></tbody></table>
165N/A
181N/A
165N/A<%
3817N/A try {
3817N/A CircleOfTrustManager cotManager = new CircleOfTrustManager();
3817N/A Set members = cotManager.getAllCirclesOfTrust("/");
3817N/A
3817N/A if ((members == null) || members.isEmpty()) {
3817N/A out.print("Misconfiguration - No circle of trust for root realm.");
3817N/A } else {
3817N/A out.print(members.toArray()[0]);
3817N/A }
3817N/A
3817N/A } catch (Exception e) {
3817N/A out.print(e.toString());
3817N/A }
3817N/A%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblBot" title="">
<tbody><tr>
<td class="MstTdTtl" width="99%">
<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>
<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, Inc." align="right" border="0" height="10" width="108" /></td></tr></tbody></table></div><div class="SkpMedGry1"><a name="SkipAnchor2089" id="SkipAnchor2089"></a></div>
<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>
<%
// Retreive the metadata information
String nameIDValue=request.getParameter("nameIDValue");
%>
<p><br>
<table border="0" width="700">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<hr>
<form method=get name="fedletAttrQuery" action=fedletAttrResp.jsp onsubmit="return checkEmptySubjectDN();">
<h1> Attribute Query </h1>
<B>Subject</B> <BR>
<%
if (nameIDValue!=null){
out.print("<input type=hidden name=nameidvalue value=\"" + ESAPI.encoder().encodeForHTML(URLEncDec.encode(nameIDValue)) + "\" > SAML2 Token (Transient)<br>");
}
String idpEntityID = request.getParameter("idpEntityID");
if(idpEntityID!=null) idpEntityID = ESAPI.encoder().encodeForHTML(idpEntityID);
String spEntityID = request.getParameter("spEntityID");
if(spEntityID!=null) spEntityID = ESAPI.encoder().encodeForHTML(spEntityID);
%>
<p>
Attribute 1 <input type=text name=attr1 value=CommonName><br>
Attribute 2 <input type=text name=attr2 value=GivenName><br>
Attribute 3 <input type=text name=attr3 value=UserStatus><br>
<input type=hidden name=idpEntityID value="<%=idpEntityID%>">
<input type=hidden name=spEntityID value="<%=spEntityID%>">
<p><B> Profile Name </B></p>
<input type="radio" name="attrQueryProfile" value="default" onclick="enableSubjectDN()" checked/> Default <br>
<input type="radio" name="attrQueryProfile" onclick="enableSubjectDN()" value="x509Subject"/> X.509 <br>
X.509 Subject DN <input type=text name=subjectDN disabled> <br>
<input type=submit>
</form>
<hr>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</body>
</html>