proxyidpfinder.jsp revision 984ea967792540448d05fba2ac6fad5dadf91fd6
0N/A<%--
0N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0N/A
0N/A Copyright (c) 2010 ForgeRock AS. All Rights Reserved.
0N/A
0N/A The contents of this file are subject to the terms
0N/A of the Common Development and Distribution License
0N/A (the License). You may not use this file except in
0N/A compliance with the License.
0N/A
0N/A You can obtain a copy of the License at
0N/A http://forgerock.org/license/CDDLv1.0.html
0N/A See the License for the specific language governing
0N/A permission and limitations under the License.
0N/A
0N/A When distributing Covered Code, include this CDDL
0N/A Header Notice in each file and include the License file
0N/A at http://forgerock.org/license/CDDLv1.0.html
0N/A If applicable, add the following below the CDDL Header,
0N/A with the fields enclosed by brackets [] replaced by
0N/A your own identifying information:
0N/A "Portions Copyrighted [year] [name of copyright owner]"
0N/A--%>
0N/A
0N/A<%@ page import="com.sun.identity.shared.encode.Base64" %>
0N/A<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
0N/A<%@ page import="java.util.List" %>
0N/A
0N/A<html>
0N/A <head>
0N/A <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
0N/A <title>IdP Selection</title>
0N/A </head>
0N/A <body>
0N/A <%
0N/A List idpList = null;
0N/A String errorURL = "idpfinderError.html";
0N/A String samlIdP = "";
0N/A String relayState = "";
0N/A String idpListSt = "";
0N/A String requestedAuthnContext ="";
0N/A
0N/A HttpSession hts = request.getSession();
0N/A if (hts == null) {
0N/A %>
0N/A <jsp:forward page="<%= errorURL %>" />
0N/A
0N/A <%
0N/A }
0N/A String [] lista = null;
0N/A idpListSt = (String) hts.getAttribute("_IDPLIST_");
0N/A if (idpListSt != null && !idpListSt.isEmpty()) {
0N/A lista = idpListSt.split(" ");
0N/A } else {
0N/A %>
0N/A <jsp:forward page="<%= errorURL %>" />
0N/A <%
0N/A }
0N/A
0N/A relayState = (String) hts.getAttribute("_RELAYSTATE_");
0N/A if (relayState == null) {
0N/A %>
0N/A <jsp:forward page="<%= errorURL %>" />
0N/A <%
0N/A }
0N/A if (relayState.isEmpty()) {
0N/A %>
0N/A <jsp:forward page="<%= errorURL %>" />
0N/A <%
0N/A }
0N/A
0N/A requestedAuthnContext = (String) hts.getAttribute("_REQAUTHNCONTEXT_");
0N/A if ( requestedAuthnContext == null) {
0N/A %>
0N/A <jsp:forward page="<%= errorURL %>" />
0N/A <%
0N/A }
0N/A if (requestedAuthnContext.isEmpty()) {
0N/A %>
0N/A <jsp:forward page="<%= errorURL %>" />
0N/A <%
0N/A }
0N/A
0N/A String spRequester = (String) hts.getAttribute("_SPREQUESTER_");
0N/A if (spRequester == null) response.sendRedirect(errorURL);
0N/A if (spRequester.isEmpty()) response.sendRedirect(errorURL);
0N/A
0N/A samlIdP = request.getParameter("_saml_idp");
0N/A if (samlIdP != null && !samlIdP.isEmpty()) {
0N/A hts.removeAttribute("_IDPLIST_");
0N/A hts.removeAttribute("_RELAYSTATE_");
0N/A hts.removeAttribute("_SPREQUESTER_");
0N/A hts.removeAttribute("_REQAUTHNCONTEXT_");
0N/A
0N/A if (relayState.indexOf("?") == -1) {
0N/A relayState += "?";
0N/A } else {
0N/A relayState += "&";
0N/A }
0N/A response.sendRedirect(relayState + "_saml_idp=" + samlIdP);
0N/A }
0N/A
0N/A %>
0N/A <h2>Welcome to the Federation Broker</h2>
0N/A <p>You are here because you initiated a request in the Service Provider <b><%= spRequester %></b> and
0N/A <br>You asked for the Assurance level <b><%= requestedAuthnContext %></b>:
0N/A </p>
0N/A <p>Please select your preferred IdP:</p>
0N/A <form action="" method="POST">
0N/A <%
0N/A if (lista != null && lista.length > 0) {
0N/A for(String preferredIDP : lista) {
0N/A String preferredIDPB64 = Base64.encode(preferredIDP.getBytes());
0N/A %>
0N/A <input type="radio" name="_saml_idp" value="<%= preferredIDPB64 %>"> <%= preferredIDP %>
0N/A <br>
0N/A <%
0N/A }
0N/A }
0N/A %>
0N/A
0N/A <p><input type="submit" value="Submit"></p>
0N/A </form>
0N/A </body>
0N/A</html>
0N/A