distAuthConfigurator.jsp revision 25e37495f2591ee8f2c057f2644ed5570b4c078d
970N/A<%--
970N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
970N/A
970N/A Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
1072N/A
970N/A The contents of this file are subject to the terms
970N/A of the Common Development and Distribution License
970N/A (the License). You may not use this file except in
970N/A compliance with the License.
970N/A
970N/A You can obtain a copy of the License at
970N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
970N/A opensso/legal/CDDLv1.0.txt
970N/A See the License for the specific language governing
970N/A permission and limitations under the License.
970N/A
970N/A When distributing Covered Code, include this CDDL
970N/A Header Notice in each file and include the License file
970N/A at opensso/legal/CDDLv1.0.txt.
970N/A If applicable, add the following below the CDDL Header,
970N/A with the fields enclosed by brackets [] replaced by
970N/A your own identifying information:
970N/A "Portions Copyrighted [year] [name of copyright owner]"
970N/A
970N/A $Id: distAuthConfigurator.jsp,v 1.9 2008/08/19 19:08:18 veiming Exp $
970N/A
970N/A--%>
970N/A
970N/A<%--
970N/A Portions Copyrighted 2011 ForgeRock Inc
970N/A Portions Copyrighted 2012 Open Source Solution Technology Corporation
970N/A--%>
970N/A<html>
970N/A<head>
970N/A<title>Configure DistAuth</title>
970N/A<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
970N/A<link rel="stylesheet" type="text/css" href="css/css_ns6up.css" />
970N/A
970N/A
970N/A<%@ page import="
970N/Acom.iplanet.am.util.SystemProperties,
970N/Acom.iplanet.services.util.Crypt,
970N/Acom.sun.identity.distauth.setup.SetupDistAuthWAR,
1105N/Acom.sun.identity.security.EncodeAction,
970N/Acom.sun.identity.shared.Constants,
970N/Ajava.io.*,
970N/Ajava.security.AccessController,
970N/Ajava.util.Properties"
970N/A%>
970N/A
970N/A<%
970N/A String configFile = System.getProperty("user.home") + File.separator
970N/A + Constants.CONFIG_VAR_DISTAUTH_BOOTSTRAP_BASE_DIR
970N/A + File.separator
970N/A + SetupDistAuthWAR.getNormalizedRealPath(
970N/A getServletConfig().getServletContext())
970N/A + "AMDistAuthConfig.properties";
970N/A String configTemplate =
970N/A "/WEB-INF/classes/AMDistAuthConfig.properties.template";
970N/A String errorMsg = null;
970N/A boolean configured = false;
970N/A String famProt = null;
970N/A String famHost = null;
970N/A String famPort = null;
970N/A String famDeploymenturi = null;
970N/A String debugDir = null;
970N/A String debugLevel = "error";
970N/A String encryptionKey = SetupDistAuthWAR.generateKey();
970N/A String distAuthProt = request.getScheme();
1130N/A String distAuthHost = request.getServerName();
970N/A String distAuthPort = String.valueOf(request.getServerPort());
970N/A String distAuthDeploymenturi = request.getContextPath();
970N/A String distAuthCookieName = "AMDistAuthCookie";
970N/A String lbCookieName = "amlbcookie";
970N/A String distAuthLBCookieName = "DistAuthLBCookieName";
970N/A String distAuthLBCookieValue = "DistAuthLBCookieValue";
970N/A String appUser = null;
970N/A String appPassword = null;
970N/A String confirmAppPassword = null;
970N/A
970N/A File configF = new File(configFile);
970N/A if (configF.exists()) {
970N/A errorMsg = "The DistAuth application has already been configued.<br>" +
970N/A "Configuration file : " + configFile + "<br><p><br>" +
970N/A "Click <a href=\"index.html\">here</a> to go to login page.";
970N/A // reinitialize properties
970N/A Properties props = new Properties();
970N/A props.load(new FileInputStream(configFile));
970N/A SystemProperties.initializeProperties(props);
970N/A configured = true;
970N/A } else {
970N/A String submit = request.getParameter("submit");
970N/A String servletPath = request.getServletPath();
970N/A
970N/A if (submit != null) {
970N/A famProt = request.getParameter("famProt");
970N/A famHost = request.getParameter("famHost");
970N/A famPort = request.getParameter("famPort");
1105N/A famDeploymenturi = request.getParameter("famDeploymenturi");
1105N/A distAuthProt = request.getParameter("distAuthProt");
970N/A distAuthHost = request.getParameter("distAuthHost");
1105N/A distAuthPort = request.getParameter("distAuthPort");
970N/A distAuthDeploymenturi = request.getParameter("distAuthDeploymenturi");
970N/A distAuthCookieName = request.getParameter("distAuthCookieName");
970N/A lbCookieName = request.getParameter("lbCookieName");
970N/A distAuthLBCookieName = request.getParameter("distAuthLBCookieName");
970N/A distAuthLBCookieValue = request.getParameter("distAuthLBCookieValue");
970N/A debugDir = request.getParameter("debugDir");
977N/A debugLevel = request.getParameter("debugLevel");
970N/A encryptionKey = request.getParameter("encryptionKey");
970N/A appUser = request.getParameter("appUser");
970N/A appPassword = request.getParameter("appPassword");
970N/A confirmAppPassword = request.getParameter("confirmAppPassword");
970N/A
970N/A if ((famProt != null) && !famProt.trim().equals("") &&
970N/A (famHost != null) && !famHost.trim().equals("") &&
970N/A (famPort != null) && !famPort.trim().equals("") &&
970N/A (famDeploymenturi != null) && !famDeploymenturi.trim().equals("") &&
982N/A (distAuthProt != null) && !distAuthProt.trim().equals("") &&
970N/A (distAuthHost != null) && !distAuthHost.trim().equals("") &&
970N/A (distAuthPort != null) && !distAuthPort.trim().equals("") &&
970N/A (distAuthDeploymenturi != null) && !distAuthDeploymenturi.trim().equals("") &&
970N/A (distAuthCookieName != null) && !distAuthCookieName.trim().equals("") &&
970N/A (lbCookieName != null) && !lbCookieName.trim().equals("") &&
970N/A distAuthLBCookieName != null && !distAuthLBCookieName.trim().equals("") &&
970N/A distAuthLBCookieName != null && !distAuthLBCookieValue.trim().equals("") &&
970N/A (debugLevel != null) && !debugLevel.trim().equals("") &&
970N/A (debugDir != null) && !debugDir.trim().equals("") &&
970N/A (encryptionKey != null) && !encryptionKey.trim().equals("") &&
970N/A (appUser != null) && !appUser.trim().equals("") &&
970N/A (appPassword != null) && !appPassword.trim().equals("") &&
970N/A appPassword.trim().equals(confirmAppPassword.trim())){
982N/A Properties props = new Properties();
970N/A props.setProperty("SERVER_PROTOCOL", famProt.trim());
970N/A props.setProperty("SERVER_HOST", famHost.trim());
970N/A props.setProperty("SERVER_PORT", famPort.trim());
970N/A if(!((famDeploymenturi.trim()).startsWith("/"))){
1105N/A famDeploymenturi= "/" + famDeploymenturi.trim();
970N/A }
970N/A props.setProperty("DEPLOY_URI", famDeploymenturi);
1105N/A props.setProperty("DISTAUTH_SERVER_PROTOCOL", distAuthProt.trim());
970N/A props.setProperty("DISTAUTH_SERVER_HOST", distAuthHost.trim());
970N/A props.setProperty("DISTAUTH_SERVER_PORT", distAuthPort.trim());
1120N/A props.setProperty("DISTAUTH_DEPLOY_URI", distAuthDeploymenturi.trim());
1120N/A props.setProperty("DISTAUTH_COOKIE_NAME", distAuthCookieName.trim());
1120N/A props.setProperty("LB_COOKIE_NAME", lbCookieName.trim());
970N/A props.setProperty("DISTAUTH_LB_COOKIE_NAME", distAuthLBCookieName.trim());
970N/A props.setProperty("DISTAUTH_LB_COOKIE_VALUE", distAuthLBCookieValue.trim());
970N/A props.setProperty("DEBUG_DIR", debugDir.trim());
970N/A props.setProperty("DEBUG_LEVEL", debugLevel.trim());
970N/A props.setProperty("ENCRYPTION_KEY", encryptionKey.trim());
970N/A props.setProperty("ENCRYPTION_KEY_LOCAL", encryptionKey.trim());
970N/A props.setProperty("APPLICATION_USER", appUser.trim());
970N/A props.setProperty("APPLICATION_PASSWD", "");
1105N/A SystemProperties.initializeProperties("am.encryption.pwd",encryptionKey.trim());
1105N/A props.setProperty("ENCODED_APPLICATION_PASSWORD",Crypt.encrypt(appPassword.trim()));
1105N/A props.setProperty("AM_COOKIE_NAME", "iPlanetDirectoryPro");
970N/A props.setProperty("AM_COOKIE_SECURE", "false");
970N/A props.setProperty("AM_COOKIE_ENCODE", "false");
970N/A props.setProperty("NAMING_URL", famProt + "://" + famHost + ":"
1105N/A + famPort + famDeploymenturi + "/namingservice");
970N/A props.setProperty("NOTIFICATION_URL", distAuthProt + "://" + distAuthHost + ":"
970N/A + distAuthPort + distAuthDeploymenturi + "/notificationservice");
970N/A
970N/A try {
970N/A SetupDistAuthWAR configurator =
970N/A new SetupDistAuthWAR(
970N/A getServletConfig().getServletContext());
970N/A configurator.createAMDistAuthConfigProperties(
970N/A configTemplate, props);
970N/A configurator.setAMDistAuthConfigProperties();
970N/A } catch (IOException ioex) {
970N/A ioex.printStackTrace();
970N/A errorMsg = "Unable to create sample " +
970N/A "AMDistAuthConfig.properties " +
970N/A "file: " + ioex.getMessage();
970N/A }
970N/A configured = true;
970N/A } else {
1057N/A errorMsg = "All the fields are required.";
970N/A if((appPassword != null) && !appPassword.equals("")){
970N/A if(!appPassword.equals(confirmAppPassword)){
970N/A errorMsg = "Application user password and confirm " +
970N/A "Application user password does not match";
970N/A }
970N/A }
970N/A }
970N/A }
1132N/A }
1132N/A%>
1132N/A
970N/A</head>
970N/A
970N/A<body class="DefBdy">
970N/A
970N/A<div class="MstDiv"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblTop" title="">
1132N/A<tbody><tr>
1132N/A<td nowrap="nowrap">&nbsp;</td>
970N/A<td nowrap="nowrap">&nbsp;</td>
970N/A</tr></tbody></table>
1132N/A
1132N/A<table width="100%" border="0" cellpadding="0" cellspacing="0" class="MstTblBot" title="">
1132N/A<tbody><tr>
1132N/A<td class="MstTdTtl" width="99%">
1132N/A<div class="MstDivTtl"><img name="ProdName" src="images/PrimaryProductName.png" alt="" /></div></td><td class="MstTdLogo" width="1%"><img name="RMRealm.mhCommon.BrandLogo" src="images/other/javalogo.gif" alt="Java(TM) Logo" border="0" height="55" width="31" /></td></tr></tbody></table>
970N/A<table class="MstTblEnd" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img name="RMRealm.mhCommon.EndorserLogo" src="images/masthead/masthead-sunname.gif" alt="Sun(TM) Microsystems, Inc." align="right" border="0" height="10" width="108" /></td></tr></tbody></table></div><div class="SkpMedGry1"><a name="SkipAnchor2089" id="SkipAnchor2089"></a></div>
1132N/A<div class="SkpMedGry1"><a href="#SkipAnchor4928"><img src="images/other/dot.gif" alt="Jump Over Tab Navigation Area. Current Selection is: Access Control" border="0" height="1" width="1" /></a></div>
1132N/A
1132N/A<table border="0" cellpadding="10" cellspacing="0" width="100%">
1132N/A<tr><td>
1132N/A
1147N/A
1147N/A<%
1147N/A if (!configured) {
1147N/A%>
1132N/A
1132N/A<h3>Configuring DistAuth Application</h3>
1132N/A
1132N/A<form action="distAuthConfigurator.jsp" method="POST">
1132N/A Please provide the OpenAM Server Information.
1132N/A <p>&nbsp;</p>
970N/A
970N/A <table border=0 cellpadding=5 cellspacing=0>
1003N/A
1003N/A<%
970N/A if (errorMsg != null) {
970N/A%>
970N/A <tr>
970N/A <td colspan="2" align="left">
970N/A <b><font color="red"><%= errorMsg %></font></b>
970N/A <br><br>
970N/A </td>
1105N/A </tr>
970N/A<%
970N/A}
970N/A%>
970N/A
970N/A <tr>
970N/A <td>Server Protocol:</td>
970N/A <td><input name="famProt" type="text" size="30" value="<%= famProt == null ? "" : famProt %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>Server Host:</td>
970N/A <td><input name="famHost" type="text" size="30" value="<%= famHost == null ? "" : famHost %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>Server Port:</td>
1105N/A <td><input name="famPort" type="text" size="30" value="<%= famPort == null ? "" : famPort %>" /></td>
1105N/A </tr>
970N/A <tr>
1105N/A <td>Server Deployment URI:</td>
1105N/A <td><input name="famDeploymenturi" type="text" size="30" value="<%= famDeploymenturi == null ? "" : famDeploymenturi %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>DistAuth Server Protocol:</td>
970N/A <td><input name="distAuthProt" type="text" size="30" value="<%= distAuthProt == null ? "" : distAuthProt %>" readonly/></td>
1105N/A </tr>
970N/A <tr>
970N/A <td>DistAuth Server Host:</td>
970N/A <td><input name="distAuthHost" type="text" size="30" value="<%= distAuthHost == null ? "" : distAuthHost %>" readonly/></td>
970N/A </tr>
970N/A <tr>
970N/A <td>DistAuth Server Port:</td>
970N/A <td><input name="distAuthPort" type="text" size="30" value="<%= distAuthPort == null ? "" : distAuthPort %>" readonly/></td>
970N/A </tr>
970N/A <tr>
970N/A <td>DistAuth Server Deployment URI:</td>
970N/A <td><input name="distAuthDeploymenturi" type="text" size="30" value="<%= distAuthDeploymenturi == null ? "" : distAuthDeploymenturi %>" readonly/></td>
970N/A </tr>
970N/A <tr>
970N/A <td>DistAuth Cookie Name:</td>
970N/A <td><input name="distAuthCookieName" type="text" size="30" value="<%= distAuthCookieName == null ? "" : distAuthCookieName %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>OpenAM LB Cookie Name:</td>
970N/A <td><input name="lbCookieName" type="text" size="30" value="<%= lbCookieName == null ? "" : lbCookieName %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>DistAuth LB Cookie Name:</td>
970N/A <td><input name="distAuthLBCookieName" type="text" size="30" value="<%= distAuthLBCookieName == null ? "" : distAuthLBCookieName %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>DistAuth LB Cookie Value:</td>
970N/A <td><input name="distAuthLBCookieValue" type="text" size="30" value="<%= distAuthLBCookieValue == null ? "" : distAuthLBCookieValue %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>Debug directory</td>
970N/A <td><input name="debugDir" type="text" size="30" value="<%= debugDir == null ? "" : debugDir %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>Debug level</td>
970N/A <td><input name="debugLevel" type="text" size="30" value="<%= debugLevel == null ? "" : debugLevel %>" /></td>
977N/A </tr>
970N/A <tr>
970N/A <td>Encryption Key</td>
970N/A <td><input name="encryptionKey" type="text" size="30" value="<%= encryptionKey == null ? "" : encryptionKey %>" /></td>
1105N/A </tr>
1105N/A <tr>
970N/A <td>Application user name</td>
970N/A <td><input name="appUser" type="text" size="30" value="<%= appUser == null ? "" : appUser %>" /></td>
970N/A </tr>
1105N/A <tr>
970N/A <td>Application user password</td>
970N/A <td><input name="appPassword" type="password" size="30" value="<%= appPassword == null ? "" : appPassword %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td>Confirm Application user password</td>
970N/A <td><input name="confirmAppPassword" type="password" size="30" value="<%= confirmAppPassword == null ? "" : confirmAppPassword %>" /></td>
970N/A </tr>
970N/A <tr>
970N/A <td> </td>
970N/A </tr>
970N/A <tr>
970N/A <td colspan="2" align="center">
970N/A <input type="submit" name="submit" value="Configure" />
970N/A <input type="reset" value="Reset" />
970N/A </td>
970N/A </tr>
970N/A </table>
970N/A</form>
970N/A
970N/A<%
970N/A} else {
970N/A%>
970N/A<p>&nbsp;</p>
970N/A<%
970N/A if (errorMsg != null) {
970N/A%>
970N/A<%= errorMsg %>
970N/A<%
970N/A} else {
970N/A%>
970N/ADistAuth application is successfully configured.<br>
970N/AAMDistAuthConfig.properties created at <%= configFile %><br>
970N/A<br>
970N/A<p>
970N/AClick <a href="index.html">here</a> to go to login page.
970N/A<%
970N/A }
970N/A}
970N/A%>
970N/A</td></tr></table>
970N/A</body>
970N/A</html>
970N/A