fedletSampleApp.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
$Id: fedletSampleApp.jsp,v 1.15 2010/01/08 21:56:58 vimal_67 Exp $
<%@ include file="header.jspf" %>
String deployuri = request.getRequestURI();
int slashLoc = deployuri.indexOf("/", 1);
deployuri = deployuri.substring(0, slashLoc);
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<div class="MstDiv"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblTop" title="">
<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>
map = SPACSUtils.processResponseForFedlet(request, response);
SAMLUtils.sendError(request, response,
response.SC_INTERNAL_SERVER_ERROR, "failedToProcessSSOResponse",
sme.getMessage());
SAMLUtils.sendError(request, response,
response.SC_INTERNAL_SERVER_ERROR, "failedToProcessSSOResponse",
ioe.getMessage());
SAMLUtils.sendError(request, response,
response.SC_INTERNAL_SERVER_ERROR, "failedToProcessSSOResponse",
se.getMessage());
SAMLUtils.sendError(request, response,
response.SC_BAD_REQUEST, "failedToProcessSSOResponse",
se.getMessage());
if ((relayUrl != null) && (relayUrl.length() != 0)) {
int stringPos = relayUrl.indexOf("sendRedirectForValidationNow=true");
response.sendRedirect(relayUrl);
// such as Reponse/Assertion/Attributes, from the returned map.
String value = nameId.getValue();
String format = nameId.getFormat();
out.println("<br><br><b>Single Sign-On successful with IDP "
out.println("<br><br>");
out.println("<table border=0>");
out.println("<tr>");
out.println("<td valign=top><b>Name ID format: </b></td>");
out.println("<td>" + format + "</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td valign=top><b>Name ID value: </b></td>");
out.println("<td>" + value + "</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td valign=top><b>SessionIndex: </b></td>");
out.println("<td>" + sessionIndex + "</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td valign=top><b>Attributes: </b></td>");
Iterator iter = attrs.keySet().iterator();
out.println("<td>");
while (iter.hasNext()) {
String attrName = (String) iter.next();
Set attrVals = (HashSet) attrs.get(attrName);
if ((attrVals != null) && !attrVals.isEmpty()) {
Iterator it = attrVals.iterator();
while (it.hasNext()) {
out.println("</td>");
out.println("</tr>");
out.println("</table>");
out.println("<br><br><b><a href=# onclick=toggleDisp('resinfo')>Click to view SAML2 Response XML</a></b><br>");
out.println("<span style='display:none;' id=resinfo><textarea rows=40 cols=100>" + samlResp.toXMLString(true, true) + "</textarea></span>");
out.println("<br><b><a href=# onclick=toggleDisp('assr')>Click to view Assertion XML</a></b><br>");
out.println("<span style='display:none;' id=assr><br><textarea rows=40 cols=100>" + assertion.toXMLString(true, true) + "</textarea></span>");
out.println("<br><b><a href=# onclick=toggleDisp('subj')>Click to view Subject XML</a></b><br>");
out.println("<span style='display:none;' id=subj><br><textarea rows=10 cols=100>" + subject.toXMLString(true, true) + "</textarea></span>");
if ((relayUrl != null) && (relayUrl.length() != 0)) {
out.println("<br><br>Click <a href=\"" + relayUrl
out.print("<p><p>");
out.println("<br><b>Test Attribute Query:</b></br>");
out.print("<p><p>");
out.print("<b><a href="+deployuri+"/fedletAttrQuery.jsp?nameIDValue="+value+"&idpEntityID="+entityID+"&spEntityID="+spEntityID+">Fedlet Attribute Query </a></b>");
out.print("<p><p>");
out.println("<br><b>Test XACML Policy Decision Query:</b></br>");
out.print("<p><p>");
out.print("<b><a href="+deployuri+"/fedletXACMLQuery.jsp?nameIDValue="+value+"&idpEntityID="+entityID+"&spEntityID="+spEntityID+">Fedlet XACML Query </a></b>");
out.print("<p><p>");
String idpBaseUrl = (String) idpMap.get("idpBaseUrl");
String idpMetaAlias = (String) idpMap.get("idpMetaAlias");
out.println("<br><b>Test Single Logout:</b></br>");
out.println("<br><b><a href=\"" + idpBaseUrl + "/IDPSloInit?metaAlias=" + idpMetaAlias + "&binding=urn:oasis:names:tc:SAML:2.0:bindings:SOAP&RelayState=" + fedletBaseUrl + "/index.jsp\">Run Identity Provider initiated Single Logout using SOAP binding</a></b></br>");
out.println("<br><b><a href=\"" + idpBaseUrl + "/IDPSloInit?metaAlias=" + idpMetaAlias + "&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect&RelayState=" + fedletBaseUrl + "/index.jsp\">Run Identity Provider initiated Single Logout using HTTP Redirect binding</a></b></br>");
out.println("<br><b><a href=\"" + idpBaseUrl + "/IDPSloInit?metaAlias=" + idpMetaAlias + "&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&RelayState=" + fedletBaseUrl + "/index.jsp\">Run Identity Provider initiated Single Logout using HTTP POST binding</a></b></br>");
out.println("<br><b><a href=\"" + fedletBaseUrl + "/fedletSloInit?spEntityID=" + URLEncDec.encode(spEntityID) + "&idpEntityID=" + URLEncDec.encode(entityID) + "&NameIDValue=" + URLEncDec.encode(value) + "&SessionIndex=" + URLEncDec.encode(sessionIndex) + "&binding=urn:oasis:names:tc:SAML:2.0:bindings:SOAP&RelayState=" + URLEncDec.encode(fedletBaseUrl + "/index.jsp") + "\">Run Fedlet initiated Single Logout using SOAP binding</a></b></br>");
out.println("<br><b><a href=\"" + fedletBaseUrl + "/fedletSloInit?spEntityID=" + URLEncDec.encode(spEntityID) + "&idpEntityID=" + URLEncDec.encode(entityID) + "&NameIDValue=" + URLEncDec.encode(value) + "&SessionIndex=" + URLEncDec.encode(sessionIndex) + "&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect&RelayState=" + URLEncDec.encode(fedletBaseUrl + "/index.jsp") + "\">Run Fedlet initiated Single Logout using HTTP Redirect binding</a></b></br>");
out.println("<br><b><a href=\"" + fedletBaseUrl + "/fedletSloInit?spEntityID=" + URLEncDec.encode(spEntityID) + "&idpEntityID=" + URLEncDec.encode(entityID) + "&NameIDValue=" + URLEncDec.encode(value) + "&SessionIndex=" + URLEncDec.encode(sessionIndex) + "&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&RelayState=" + URLEncDec.encode(fedletBaseUrl + "/index.jsp") + "\">Run Fedlet initiated Single Logout using HTTP POST binding</a></b></br>");
var elem = document.getElementById(id);
if (elem.style.display == 'none')
elem.style.display = '';
elem.style.display = 'none';