realmSelection.jsp revision e6c3a72a023407f5d1fface64356e1cc81f1af31
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou The contents of this file are subject to the terms
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou of the Common Development and Distribution License
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou (the License). You may not use this file except in
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou compliance with the License.
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou You can obtain a copy of the License at
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou https://opensso.dev.java.net/public/CDDLv1.0.html or
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou See the License for the specific language governing
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou permission and limitations under the License.
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou When distributing Covered Code, include this CDDL
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Header Notice in each file and include the License file
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou If applicable, add the following below the CDDL Header,
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou with the fields enclosed by brackets [] replaced by
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou your own identifying information:
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou "Portions Copyrighted [year] [name of copyright owner]"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou $Id: realmSelection.jsp,v 1.10 2009/10/29 00:00:00 exu Exp $
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Portions Copyrighted 2013-2016 ForgeRock AS.
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou import="com.sun.identity.wsfederation.common.WSFederationConstants"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou import="com.sun.identity.wsfederation.common.WSFederationUtils"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou import="com.sun.identity.wsfederation.meta.WSFederationMetaManager"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou import="com.sun.identity.wsfederation.meta.WSFederationMetaUtils"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou import="com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou import="com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String jspFile = "realmSelection.jsp: ";
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String wreply = (String)request.getParameter("wreply");
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + wreply, wreply,
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou "URL", 2000, false)){
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String wctx = (String)request.getParameter("wctx");
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + wctx, wctx,
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou "HTTPParameterValue", 2000, true)){
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou debug.message(jspFile + "wreply: "+wreply);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String spMetaAlias = WSFederationMetaUtils.getMetaAliasByUri(
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if ( spMetaAlias==null || spMetaAlias.length()==0) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou response.sendError(response.SC_BAD_REQUEST, "Null metaAlias"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou /* TODO SAML2Utils.bundle.getString("nullSPEntityID") */);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou WSFederationMetaManager metaManager =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String spEntityId =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou metaManager.getEntityByMetaAlias(spMetaAlias);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String spRealm = WSFederationMetaUtils.getRealmByMetaAlias(spMetaAlias);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Map<String,List<String>> spConfig =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou metaManager.getSPSSOConfig(spRealm,spEntityId));
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String accountRealmCookieName =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou spConfig.get(WSFederationConstants.ACCOUNT_REALM_COOKIE_NAME).get(0);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String selectedRealm = (String)request.getParameter("realm_list");
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + selectedRealm,
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou selectedRealm, "HTTPParameterValue", 2000, true)){
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou selectedRealm = null;
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou debug.message(jspFile + "Selected realm: " + selectedRealm);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if ( selectedRealm != null )
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou StringBuffer url = new StringBuffer(wreply);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou url.append(selectedRealm);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (wctx != null) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou debug.message(jspFile + "Redirecting to: "+url);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String contextPath = request.getContextPath();
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<title>OpenAM (Realm Selection)</title>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<link rel="stylesheet" href="<%= contextPath %>/css/styles.css" type="text/css" />
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<script language="JavaScript" src="<%= contextPath %>/js/browserVersion.js"></script>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<script language="JavaScript" src="<%= contextPath %>/js/auth.js"></script>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<script language="JavaScript">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou writeCSS('<%= contextPath %>');
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou function formSubmit() {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou var frm = document.forms['realm_form'];
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (frm != null) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<script type="text/javascript"><!--// Empty script so IE5.0 Windows will draw table and button borders
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou<body class="LogBdy" onload="placeCursorOnFirstElm();">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <table border="0" cellpadding="0" cellspacing="0" align="center" title="">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td width="50%"><img src="<%= contextPath %>/images/dot.gif" width="1" height="1" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td><img src="<%= contextPath %>/images/dot.gif" width="728" height="1" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td width="50%"><img src="<%= contextPath %>/images/dot.gif" width="1" height="1" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <tr class="LogTopBnd" style="background-image: url(<%= contextPath %>/images/gradlogtop.jpg);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou background-repeat: repeat-x; background-position: left top;">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td><img src="<%= contextPath %>/images/dot.gif" width="1" height="30" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td> </td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td class="LogMidBnd" style="background-image: url(<%= contextPath %>/images/gradlogsides.jpg);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou background-repeat:repeat-x;background-position:left top;"> </td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td class="LogCntTd" style="background-image: url(<%= contextPath %>/images/login-backimage-long.jpg);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou background-repeat:no-repeat;background-position:left top;" height="435" align="center" valign="middle">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <table border="0" background="<%= contextPath %>/images/dot.gif" cellpadding="0" cellspacing="0"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou width="100%" title="">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td width="260"><img src="<%= contextPath %>/images/dot.gif" width="260" height="245" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td width="415" bgcolor="#ffffff" valign="top">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <form name="realm_form" action="<%=request.getRequestURI()%>"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou onSubmit="formSubmit(); return false;" method="post">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <table border="0" cellspacing="0" cellpadding="0">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td colspan="2">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <img src="<%= contextPath %>/images/dot.gif" width="1" height="25" alt="" />
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <!-- Header display -->
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td nowrap="nowrap"></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td><div class="logTxtSvrNam">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Account Realm Selection
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <!-- End of Header display -->
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <!-- text box display -->
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td nowrap="nowrap"><div class="logLbl">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <span class="LblLev2Txt">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <label for="IDToken1">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou </label></span></div>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td><div class="logInp">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <input type="hidden" name="wreply" value="<%=wreply%>" />
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if ( wctx != null && wctx.length() > 0 ) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <input type="hidden" name="wctx" value="<%=wctx%>" />
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <select name="realm_list">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String accountRealmCookieValue = null;
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Cookie cookies[] = request.getCookies();
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (cookies != null) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou for (int i = 0; i < cookies.length; i++) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (cookies[i].getName().equals( accountRealmCookieName ))
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou accountRealmCookieValue = cookies[i].getValue();
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou debug.message(jspFile + "Account Realm Cookie: " +
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou accountRealmCookieValue);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou for (String idpEntityId :
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou metaManager.getAllRemoteIdentityProviderEntities(spRealm))
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou FederationElement idp =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou idpEntityId);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou IDPSSOConfigElement idpconfig =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou idpEntityId);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou spEntityId, idpEntityId) ) {
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String issuerName = metaManager.
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou getTokenIssuerName(idp);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou String displayName =
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou WSFederationMetaUtils.getAttribute(idpconfig,
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou debug.message(jspFile + "account realm key: " +
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou issuerName + " display name: " + displayName);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou if (displayName == null || displayName.length() == 0){
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou displayName = issuerName;
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <option value="<%=issuerName%>"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <%=((accountRealmCookieValue != null) &&
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou (accountRealmCookieValue.equals(issuerName))?"selected":"")%>>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <%=displayName%>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <!-- end of textBox -->
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <!-- Submit button -->
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td><img src="<%= contextPath %>/images/dot.gif"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou width="1" height="15" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <script language="javascript">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou markupButton(
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou "javascript:formSubmit()");
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <!-- end of Submit button -->
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td> </td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td><img src="<%= contextPath %>/images/dot.gif"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou width="1" height="33" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td> </td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td width="45"><img src="<%= contextPath %>/images/dot.gif"
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou width="45" height="245" alt="" /></td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td class="LogMidBnd" style="background-image: url(<%= contextPath %>/images/gradlogsides.jpg);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou background-repeat:repeat-x;background-position:left top;"> </td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <tr class="LogBotBnd" style="background-image: url(<%= contextPath %>/images/gradlogbot.jpg);
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou background-repeat:repeat-x;background-position:left top;">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td> </td>
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <div class="logCpy"><span class="logTxtCpy">
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou Copyright © 2008-2016, ForgeRock AS. All Rights Reserved. Use of this software is subject to the terms and conditions of the ForgeRock™ License and Subscription Agreement.
5e5acc733bf20faa22d4e9be582f555bbda0867bLudovic Poitou <td> </td>