Show cdcpage.jsp syntax highlighted
<%--
* Copyright (C) 2002-2004 Ping Identity Corporation. All rights reserved.
*
* Licensed under the Open Software License version 2.1
*
* A copy of this license has been provided with the distribution of this
* software. Additionally, a copy of this license is available at:
* http://www.pingidentity.com/license
--%>
<%@ page import="org.sourceid.idff12.config.*,
org.apache.xmlbeans.impl.util.HexBin,
org.apache.xmlbeans.impl.util.Base64" %>
<html>
<head>
<title>SP Site Login Page</title>
</head>
<body>
The common domain cookies resolve to:
<div>
<table border="1">
<thead>
<tr>
<td>Organizational Name</td>
<td>Provider ID</td>
<td>Source ID</td>
</tr>
</thead>
<%
String tokenstr = (String)request.getParameter("cdc");
if (tokenstr == null || tokenstr.length() == 0)
{
out.println("<tr><td colspan='3'>No Identity Providers returned</td></tr>");
}
else
{
String tokens[] = tokenstr.split("\\s"); // \s matches any whitespace character
ProviderDirectory directory = ProviderDirectoryFactory.getDirectory();
for (int i = 0; i < tokens.length; i++)
{
String hexToken = HexBin.bytesToString(Base64.decode(tokens[i].getBytes("UTF-8")));
String providerID = null;
try
{
providerID = directory.getProviderIdBySourceId(hexToken);
}
// if this fails, just leave null.
catch(Exception e)
{}
StringBuffer buffer = new StringBuffer();
if (providerID != null)
{
buffer.append("<tr><td>");
buffer.append(directory.getOrganizationDisplayName(providerID));
buffer.append("</td><td>");
buffer.append(providerID);
buffer.append("</td><td>");
buffer.append(hexToken);
buffer.append("</td></tr>");
}
else
{
buffer.append("<tr><td colspan=\"2\">" +
"SourceID does not resolve</td><td>");
buffer.append(hexToken);
buffer.append("</td></tr>");
}
out.println(buffer.toString());
}
}
%>
</table>
</div>
</body>
</html>
See more files for this project here