realmSelection.jsp revision e6c3a72a023407f5d1fface64356e1cc81f1af31
0N/A<%--
0N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0N/A
0N/A Copyright (c) 2007 Sun Microsystems Inc. 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 https://opensso.dev.java.net/public/CDDLv1.0.html or
0N/A opensso/legal/CDDLv1.0.txt
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 opensso/legal/CDDLv1.0.txt.
873N/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 $Id: realmSelection.jsp,v 1.10 2009/10/29 00:00:00 exu Exp $
5065N/A
6332N/A Portions Copyrighted 2013-2016 ForgeRock AS.
0N/A--%>
0N/A
0N/A<%@page
857N/A import="java.util.*"
857N/A import="com.sun.identity.shared.debug.Debug"
5636N/A import="com.sun.identity.wsfederation.common.WSFederationConstants"
3266N/A import="com.sun.identity.wsfederation.common.WSFederationUtils"
1920N/A import="com.sun.identity.wsfederation.meta.WSFederationMetaManager"
828N/A import="com.sun.identity.wsfederation.meta.WSFederationMetaUtils"
3196N/A import="com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement"
5636N/A import="com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement"
5636N/A import="org.owasp.esapi.ESAPI"
5636N/A%>
3196N/A<%
3824N/A Debug debug = WSFederationUtils.debug;
3824N/A String jspFile = "realmSelection.jsp: ";
3824N/A String wreply = (String)request.getParameter("wreply");
3824N/A if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + wreply, wreply,
3824N/A "URL", 2000, false)){
3824N/A wreply = "";
5728N/A }
3842N/A String wctx = (String)request.getParameter("wctx");
3842N/A if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + wctx, wctx,
3824N/A "HTTPParameterValue", 2000, true)){
3842N/A wctx = null;
6332N/A }
1298N/A
6332N/A if (debug.messageEnabled()) {
6332N/A debug.message(jspFile + "wreply: "+wreply);
6332N/A }
6332N/A
6332N/A String spMetaAlias = WSFederationMetaUtils.getMetaAliasByUri(
6332N/A request.getRequestURI());
6332N/A if ( spMetaAlias==null || spMetaAlias.length()==0) {
6332N/A response.sendError(response.SC_BAD_REQUEST, "Null metaAlias"
1298N/A /* TODO SAML2Utils.bundle.getString("nullSPEntityID") */);
1298N/A return;
1298N/A }
1298N/A
1298N/A WSFederationMetaManager metaManager =
1298N/A WSFederationUtils.getMetaManager();
2976N/A String spEntityId =
2976N/A metaManager.getEntityByMetaAlias(spMetaAlias);
4495N/A String spRealm = WSFederationMetaUtils.getRealmByMetaAlias(spMetaAlias);
2976N/A Map<String,List<String>> spConfig =
857N/A WSFederationMetaUtils.getAttributes(
1298N/A metaManager.getSPSSOConfig(spRealm,spEntityId));
1298N/A String accountRealmCookieName =
5636N/A spConfig.get(WSFederationConstants.ACCOUNT_REALM_COOKIE_NAME).get(0);
832N/A
961N/A String selectedRealm = (String)request.getParameter("realm_list");
961N/A if (!ESAPI.validator().isValidInput("HTTP Parameter Value: " + selectedRealm,
961N/A selectedRealm, "HTTPParameterValue", 2000, true)){
961N/A selectedRealm = null;
961N/A }
961N/A if (debug.messageEnabled()) {
961N/A debug.message(jspFile + "Selected realm: " + selectedRealm);
961N/A }
5065N/A if ( selectedRealm != null )
832N/A {
961N/A StringBuffer url = new StringBuffer(wreply);
1298N/A url.append("?whr=");
3824N/A url.append(selectedRealm);
5065N/A if (wctx != null) {
832N/A url.append("&wctx=");
961N/A url.append(wctx);
1298N/A }
3196N/A if (debug.messageEnabled()) {
3196N/A debug.message(jspFile + "Redirecting to: "+url);
3196N/A }
5636N/A response.sendRedirect(url.toString());
5636N/A return;
5636N/A }
3824N/A
5065N/A String contextPath = request.getContextPath();
832N/A%>
961N/A<html>
1298N/A<head>
3824N/A<title>OpenAM (Realm Selection)</title>
961N/A<link rel="stylesheet" href="<%= contextPath %>/css/styles.css" type="text/css" />
857N/A<script language="JavaScript" src="<%= contextPath %>/js/browserVersion.js"></script>
961N/A<script language="JavaScript" src="<%= contextPath %>/js/auth.js"></script>
1298N/A<script language="JavaScript">
3824N/A
832N/A writeCSS('<%= contextPath %>');
961N/A
857N/A function formSubmit() {
961N/A var frm = document.forms['realm_form'];
1298N/A
3824N/A if (frm != null) {
961N/A frm.submit();
961N/A }
961N/A }
1298N/A
5636N/A</script>
828N/A<script type="text/javascript"><!--// Empty script so IE5.0 Windows will draw table and button borders
828N/A//-->
961N/A</script>
1298N/A</head>
5636N/A
961N/A<body class="LogBdy" onload="placeCursorOnFirstElm();">
1298N/A
5636N/A <table border="0" cellpadding="0" cellspacing="0" align="center" title="">
5636N/A <tr>
961N/A <td width="50%"><img src="<%= contextPath %>/images/dot.gif" width="1" height="1" alt="" /></td>
3824N/A <td><img src="<%= contextPath %>/images/dot.gif" width="728" height="1" alt="" /></td>
3824N/A <td width="50%"><img src="<%= contextPath %>/images/dot.gif" width="1" height="1" alt="" /></td>
961N/A </tr>
828N/A <tr class="LogTopBnd" style="background-image: url(<%= contextPath %>/images/gradlogtop.jpg);
5065N/A background-repeat: repeat-x; background-position: left top;">
5065N/A <td><img src="<%= contextPath %>/images/dot.gif" width="1" height="30" alt="" /></td>
5065N/A <td>&nbsp;</td>
832N/A </tr>
5065N/A <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-long.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">
<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 &copy; 2008-2016, ForgeRock AS. All Rights Reserved. Use of this software is subject to the terms and conditions of the ForgeRock&#8482; License and Subscription Agreement.
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>