realmSelection.jsp revision b93185b577f7150fec37f9999b95b246d73bf63c
0b0582a3aa10227767e359e693c4b43fec272388nd<%--
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding The contents of this file are subject to the terms
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding of the Common Development and Distribution License
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding (the License). You may not use this file except in
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd compliance with the License.
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd You can obtain a copy of the License at
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd https://opensso.dev.java.net/public/CDDLv1.0.html or
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd opensso/legal/CDDLv1.0.txt
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd See the License for the specific language governing
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd permission and limitations under the License.
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd When distributing Covered Code, include this CDDL
bfb214f8ec1b83a124e7a8caa495e3e8f19e9c75nd Header Notice in each file and include the License file
0b0582a3aa10227767e359e693c4b43fec272388nd at opensso/legal/CDDLv1.0.txt.
257db686a601ee0406953b7c3650da53adfc8b13nd If applicable, add the following below the CDDL Header,
0b0582a3aa10227767e359e693c4b43fec272388nd with the fields enclosed by brackets [] replaced by
257db686a601ee0406953b7c3650da53adfc8b13nd your own identifying information:
257db686a601ee0406953b7c3650da53adfc8b13nd "Portions Copyrighted [year] [name of copyright owner]"
0b0582a3aa10227767e359e693c4b43fec272388nd
0b0582a3aa10227767e359e693c4b43fec272388nd $Id: realmSelection.jsp,v 1.10 2009/10/29 00:00:00 exu Exp $
45de0209f6fdd98b9961f9641f85d572e14e3edcnd
257db686a601ee0406953b7c3650da53adfc8b13nd--%>
257db686a601ee0406953b7c3650da53adfc8b13nd
0b0582a3aa10227767e359e693c4b43fec272388nd<%@page
0b0582a3aa10227767e359e693c4b43fec272388nd import="java.util.*"
0b0582a3aa10227767e359e693c4b43fec272388nd import="com.sun.identity.shared.debug.Debug"
faf6c84e04f42e04b49985b4a28973dfd36e563fnd import="com.sun.identity.wsfederation.common.WSFederationConstants"
257db686a601ee0406953b7c3650da53adfc8b13nd import="com.sun.identity.wsfederation.common.WSFederationUtils"
257db686a601ee0406953b7c3650da53adfc8b13nd import="com.sun.identity.wsfederation.meta.WSFederationMetaManager"
257db686a601ee0406953b7c3650da53adfc8b13nd import="com.sun.identity.wsfederation.meta.WSFederationMetaUtils"
257db686a601ee0406953b7c3650da53adfc8b13nd import="com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement"
0b0582a3aa10227767e359e693c4b43fec272388nd import="com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement"
%>
<%
Debug debug = WSFederationUtils.debug;
String jspFile = "realmSelection.jsp: ";
String wreply = (String)request.getParameter("wreply");
String wctx = (String)request.getParameter("wctx");
if (debug.messageEnabled()) {
debug.message(jspFile + "wreply: "+wreply);
}
String spMetaAlias = WSFederationMetaUtils.getMetaAliasByUri(
request.getRequestURI());
if ( spMetaAlias==null || spMetaAlias.length()==0) {
response.sendError(response.SC_BAD_REQUEST, "Null metaAlias"
/* TODO SAML2Utils.bundle.getString("nullSPEntityID") */);
return;
}
WSFederationMetaManager metaManager =
WSFederationUtils.getMetaManager();
String spEntityId =
metaManager.getEntityByMetaAlias(spMetaAlias);
String spRealm = WSFederationMetaUtils.getRealmByMetaAlias(spMetaAlias);
Map<String,List<String>> spConfig =
WSFederationMetaUtils.getAttributes(
metaManager.getSPSSOConfig(spRealm,spEntityId));
String accountRealmCookieName =
spConfig.get(WSFederationConstants.ACCOUNT_REALM_COOKIE_NAME).get(0);
String selectedRealm = (String)request.getParameter("realm_list");
if (debug.messageEnabled()) {
debug.message(jspFile + "Selected realm: " + selectedRealm);
}
if ( selectedRealm != null )
{
StringBuffer url = new StringBuffer(wreply);
url.append("?whr=");
url.append(selectedRealm);
if (wctx != null) {
url.append("&wctx=");
url.append(wctx);
}
if (debug.messageEnabled()) {
debug.message(jspFile + "Redirecting to: "+url);
}
response.sendRedirect(url.toString());
return;
}
String contextPath = request.getContextPath();
%>
<html>
<head>
<title>OpenAM (Realm Selection)</title>
<link rel="stylesheet" href="<%= contextPath %>/css/styles.css" type="text/css" />
<script language="JavaScript" src="<%= contextPath %>/js/browserVersion.js"></script>
<script language="JavaScript" src="<%= contextPath %>/js/auth.js"></script>
<script language="JavaScript">
writeCSS('<%= contextPath %>');
function formSubmit() {
var frm = document.forms['realm_form'];
if (frm != null) {
frm.submit();
}
}
</script>
<script type="text/javascript"><!--// Empty script so IE5.0 Windows will draw table and button borders
//-->
</script>
</head>
<body class="LogBdy" onload="placeCursorOnFirstElm();">
<table border="0" cellpadding="0" cellspacing="0" align="center" title="">
<tr>
<td width="50%"><img src="<%= contextPath %>/images/dot.gif" width="1" height="1" alt="" /></td>
<td><img src="<%= contextPath %>/images/dot.gif" width="728" height="1" alt="" /></td>
<td width="50%"><img src="<%= contextPath %>/images/dot.gif" width="1" height="1" alt="" /></td>
</tr>
<tr class="LogTopBnd" style="background-image: url(<%= contextPath %>/images/gradlogtop.jpg);
background-repeat: repeat-x; background-position: left top;">
<td><img src="<%= contextPath %>/images/dot.gif" width="1" height="30" alt="" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="LogMidBnd" style="background-image: url(<%= contextPath %>/images/gradlogsides.jpg);
background-repeat:repeat-x;background-position:left top;">&nbsp;</td>
<td class="LogCntTd" style="background-image: url(<%= contextPath %>/images/login-backimage.jpg);
background-repeat:no-repeat;background-position:left top;" height="435" align="center" valign="middle">
<table border="0" background="<%= contextPath %>/images/dot.gif" cellpadding="0" cellspacing="0"
width="100%" title="">
<tr>
<td width="260"><img src="<%= contextPath %>/images/dot.gif" width="260" height="245" alt="" /></td>
<td width="415" bgcolor="#ffffff" valign="top"><img name="Login.productLogo"
src="<%= contextPath %>/images/PrimaryProductName.png" alt="OpenAM"
border="0" />
<form name="realm_form" action="<%=request.getRequestURI()%>"
onSubmit="formSubmit(); return false;" method="post">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<img src="<%= contextPath %>/images/dot.gif" width="1" height="25" alt="" />
</td>
</tr>
<!-- Header display -->
<tr>
<td nowrap="nowrap"></td>
<td><div class="logTxtSvrNam">
Account Realm Selection
</div></td>
</tr>
<!-- End of Header display -->
<!-- text box display -->
<tr>
<td nowrap="nowrap"><div class="logLbl">
<span class="LblLev2Txt">
<label for="IDToken1">
&nbsp;
</label></span></div>
</td>
<td><div class="logInp">
<input type="hidden" name="wreply" value="<%=wreply%>" />
<%
if ( wctx != null && wctx.length() > 0 ) {
%>
<input type="hidden" name="wctx" value="<%=wctx%>" />
<%
}
%>
<select name="realm_list">
<%
String accountRealmCookieValue = null;
Cookie cookies[] = request.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equals( accountRealmCookieName ))
{
accountRealmCookieValue = cookies[i].getValue();
break;
}
}
}
if (debug.messageEnabled()) {
debug.message(jspFile + "Account Realm Cookie: " +
accountRealmCookieValue);
}
for (String idpEntityId :
metaManager.getAllRemoteIdentityProviderEntities(spRealm))
{
FederationElement idp =
metaManager.getEntityDescriptor(spRealm,
idpEntityId);
IDPSSOConfigElement idpconfig =
metaManager.getIDPSSOConfig(spRealm,
idpEntityId);
if ( metaManager.isTrustedProvider(spRealm,
spEntityId, idpEntityId) ) {
String issuerName = metaManager.
getTokenIssuerName(idp);
String displayName =
WSFederationMetaUtils.getAttribute(idpconfig,
WSFederationConstants.DISPLAY_NAME);
if (debug.messageEnabled()) {
debug.message(jspFile + "account realm key: " +
issuerName + " display name: " + displayName);
}
if (displayName == null || displayName.length() == 0){
displayName = issuerName;
}
%>
<option value="<%=issuerName%>"
<%=((accountRealmCookieValue != null) &&
(accountRealmCookieValue.equals(issuerName))?"selected":"")%>>
<%=displayName%>
</option>
<%
}
}
%>
</select>
</div>
</td>
</tr>
<!-- end of textBox -->
<!-- Submit button -->
<tr>
<td><img src="<%= contextPath %>/images/dot.gif"
width="1" height="15" alt="" /></td>
<script language="javascript">
markupButton(
'Proceed',
"javascript:formSubmit()");
</script>
</tr>
<!-- end of Submit button -->
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="<%= contextPath %>/images/dot.gif"
width="1" height="33" alt="" /></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</td>
<td width="45"><img src="<%= contextPath %>/images/dot.gif"
width="45" height="245" alt="" /></td>
</tr>
</table>
</td>
<td class="LogMidBnd" style="background-image: url(<%= contextPath %>/images/gradlogsides.jpg);
background-repeat:repeat-x;background-position:left top;">&nbsp;</td>
</tr>
<tr class="LogBotBnd" style="background-image: url(<%= contextPath %>/images/gradlogbot.jpg);
background-repeat:repeat-x;background-position:left top;">
<td>&nbsp;</td>
<td><div class="logCpy"><span class="logTxtCpy">
Copyright © 2005 Sun Microsystems, Inc. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries.U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. This distribution may include materials developed by third parties.Sun, Sun Microsystems and the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.<br><br>Copyright © 2005 Sun Microsystems, Inc. Tous droits réservés.Sun Microsystems, Inc. détient les droits depropriété intellectuels relatifs à la technologie incorporée dans le produit qui est décrit dans ce document. En particulier, et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plus des brevets américains listés à l'adresse http://www.sun.com/patents et un ou les brevets supplémentaires ou les applications de brevet en attente aux Etats - Unis et dans les autres pays.L'utilisation est soumise aux termes du contrat de licence.Cette distribution peut comprendre des composants développés par des tierces parties.Sun, Sun Microsystems et le logo Sun sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays.</span></div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>