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