index.jsp revision 9740fa737ef2ed9453ab46d145777dbbbf6a747b
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
805facedb9b29cd22bf724281f2d7f150ae2fa55Felipe C. da S. Sanches The contents of this file are subject to the terms
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches of the Common Development and Distribution License
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches (the License). You may not use this file except in
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches compliance with the License.
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches You can obtain a copy of the License at
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches https://opensso.dev.java.net/public/CDDLv1.0.html or
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches See the License for the specific language governing
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches permission and limitations under the License.
ebcb6fd8e71c0fc7f7bec3930c260864ef664adeFelipe C. da S. Sanches When distributing Covered Code, include this CDDL
$Id: index.jsp,v 1.14 2009/06/09 20:28:30 exu Exp $
<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
<%@ page import="com.sun.identity.saml2.meta.SAML2MetaException" %>
<%@ page import="com.sun.identity.saml2.meta.SAML2MetaManager" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.File" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.FileOutputStream" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="org.owasp.esapi.ESAPI" %>
<%@ include file="header.jspf" %>
index.jsp contains links to test SP or IDP initiated Single Sign-on
String deployuri = request.getRequestURI();
int slashLoc = deployuri.indexOf("/", 1);
deployuri = deployuri.substring(0, slashLoc);
if ((fedletHomeDir == null) || (fedletHomeDir.trim().length() == 0)) {
fedletHomeDir = File.separator + "fedlet";
File.separator + "fedlet";
<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>
String param = request.getParameter("CreateConfig");
if ((param != null) && param.equalsIgnoreCase("true")) {
"idp.xml",
"sp.xml",
"fedlet.cot"};
if (!dir.exists()) {
if (!dir.mkdirs()) {
} else if (dir.isFile()) {
for (int i = 0; i < files.length; i++) {
src = servletCtx.getResourceAsStream(source);
while ((length = src.read(bytes)) != -1) {
fos.write(bytes, 0, length);
" could not be found in fedlet.war");
throw new SAML2Exception(e.getMessage());
fos.close();
src.close();
out.println("<p><br><b>Fedlet configuration created under \"" +
getResourceAsStream("/conf/FederationConfig.properties");
File file = new File(fedletHomeDir + File.separator +
out.println("<p><br><b>Fedlet configuration home directory does not exist.</b>");
out.println("<br><br>Click <a href=\"index.jsp?CreateConfig=true\">here</a> to create Fedlet configuration automatically.");
out.println("<br>Or manually extract your fedlet.war and copy all files under \"conf\" directory to \"" + fedletHomeDir + "\" directory, then restart your web container.");
out.println("<br>Please follow the README bundled inside your Fedlet-unconfigured.zip file to setup Fedlet configuration, then restart your web container.");
} else if (!file.exists()) {
out.println("<br><br>Click <a href=\"index.jsp?CreateConfig=true\">here</a> to create Fedlet configuration automatically.");
out.println("<br>Or manually extract your fedlet.war and copy all files under \"conf\" directory to \"" + fedletHomeDir + "\" directory, then restart your web container.");
out.println("<br>Please follow the README bundled inside your Fedlet-unconfigured.zip file to setup Fedlet configuration, then restart your web container.");
if ((spEntities != null) && !spEntities.isEmpty()) {
spEntityID = (String) spEntities.get(0);
if ((spMetaAliases != null) && !spMetaAliases.isEmpty()) {
spMetaAlias = (String) spMetaAliases.get(0);
idpEntityID = request.getParameter("idpEntityID");
if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " +
if ((idpEntityID == null) || (idpEntityID.length() == 0)) {
if ((idpEntities != null) && !idpEntities.isEmpty()) {
int numOfIDP = idpEntities.size();
String idpID = (String) idpEntities.get(j);
if (manager.isTrustedProvider("/",
trustedIDPs.add(idpID);
if (trustedIDPs.size() > 1) {
int numOfIDP = trustedIDPs.size();
out.println("<p><br><b>Multiple Identity Providers are configured with this Fedlet.</b><br>");
out.println("<br><b>Please select the Identity Provider to validate the Fedlet setup :</b><br>");
String thisURI = request.getRequestURI();
if (thisURI.indexOf("?") != -1) {
idpEntityID = (String) trustedIDPs.get(j);
out.println("<br><a href=\"" + thisURI + "idpEntityID="
out.println("<br><br><b>or </b><br>");
out.println("<a href=\"" + deployuri +
"/saml2/jsp/fedletSSOInit.jsp?metaAlias=" + spMetaAlias
out.println("</body>");
out.println("</html>");
} else if (!trustedIDPs.isEmpty()) {
idpEntityID = (String) trustedIDPs.get(0);
out.println("<p><br><b>Fedlet or remote Identity Provider metadata is not configured.</b>");
out.println("<p><br>Click <a href=\"index.jsp?CreateConfig=true\">here</a> to create Fedlet configuration automatically.");
out.println("<br>Or manually extract your fedlet.war and copy all files under \"conf\" directory to \"" + fedletHomeDir + "\" directory, then restart your web container.");
out.println("<br>Please follow the README bundled inside your Fedlet-unconfigured.zip file to setup Fedlet configuration, then restart your web container.");
String idpBaseUrl = (String)idpMap.get("idpBaseUrl");
idpMetaAlias = (String)idpMap.get("idpMetaAlias");
Click following links to start Fedlet(SP) and/or IDP initiated
<td colspan="2"><a href="<%= fedletBaseUrl %>/saml2/jsp/fedletSSOInit.jsp?metaAlias=<%= spMetaAlias %>&idpEntityID=<%= idpEntityID%>&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST">Run Fedlet (SP) initiated Single Sign-On using HTTP POST binding</a></td>
<td colspan="2"><a href="<%= fedletBaseUrl %>/saml2/jsp/fedletSSOInit.jsp?metaAlias=<%= spMetaAlias %>&idpEntityID=<%= idpEntityID %>&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact">Run Fedlet (SP) initiated Single Sign-On using HTTP Artifact binding</a></td>
if ((idpMetaAlias != null) && (idpMetaAlias.length() != 0)){
<td colspan="2"><a href="<%= idpBaseUrl %>/idpssoinit?NameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:transient&metaAlias=<%= idpMetaAlias %>&spEntityID=<%=spEntityID %>&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST">Run Identity Provider initiated Single Sign-On using HTTP POST binding</a></td>
<td colspan="2"><a href="<%= idpBaseUrl %>/idpssoinit?NameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:transient&metaAlias=<%= idpMetaAlias %>&spEntityID=<%=spEntityID %>&binding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact">Run Identity Provider initiated Single Sign-On using HTTP Artifact binding</a></td>