Commit 5327cf5a authored by Matt Tucker's avatar Matt Tucker Committed by matt

Additional work on LDAP setup process.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5490 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5fb52d75
......@@ -1335,6 +1335,8 @@ setup.ldap.connection_settings=Connection Settings
setup.ldap.user_mapping=User Mapping
setup.ldap.group_mapping=Group Mapping
setup.ldap.step_one=Step 1 of 3
setup.ldap.continue=Save & Continue
setup.ldap.test=Test Settings
setup.ldap.server.title=Profile Settings - Directory Server
setup.ldap.server.description=Configure connection settings for your LDAP directory below. All \
......@@ -1348,14 +1350,17 @@ setup.ldap.server.type_other=Other or Unknown
setup.ldap.server.type_help=The type of directory server you are connecting to.
setup.ldap.server.host=Host
setup.ldap.server.host_help=LDAP server host name; e.g. ldap.example.com, etc.
setup.ldap.server.host_error=Enter a valid LDAP server host name.
setup.ldap.server.port=Port
setup.ldap.server.port_help=LDAP server port number. The default value is 389.
setup.ldap.server.port_error=Enter a valid LDAP server port number.
setup.ldap.server.basedn=Base DN
setup.ldap.server.basedn_help=The starting DN that contains all user accounts. The entire subtree \
under the base DN will be searched for user accounts (unless subtree searching is disabled).
setup.ldap.server.basedn_error=Enter a valid LDAP base DN.
setup.ldap.server.auth=Authentication
setup.ldap.server.admindn=Administrator DN
setup.ldap.server.admindn_help=The DN of a directory administrator. All directory operations will be \
setup.ldap.server.admindn_help=The full DN of a directory administrator. All directory operations will be \
performed with this account. The admin must be able to perform searches and load user records. \
The user does not need to be able to make changes to the directory, as Wildfire treats the \
directory as read-only. If this property is not set, an anonymous login to the server will be attempted.
......@@ -1367,8 +1372,9 @@ setup.ldap.server.connection_pool_help=Connection Pooling. Default is 'Yes'
setup.ldap.server.ssl=Use SSL
setup.ldap.server.ssl_help=Enable SSL connections to your LDAP server, default port is usually 636
setup.ldap.server.debug=Enable Debug
setup.ldap.server.debug_help=Trace information about buffers written to System.out
setup.ldap.server.
setup.ldap.server.debug_help=Write trace information about LDAP connections to System.out
setup.ldap.server.referral=Follow Referrals
setup.ldap.server.referral_help=Automatically follow LDAP referrals when found
# Setup finished Page
......
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%--
- $RCSfile$
- $Revision: 1772 $
......@@ -210,8 +209,7 @@
</p>
<% if (errors.size() > 0) { %>
<span class="jive-error-text">
<div class="error">
<% if (errors.get("general") != null) { %>
<%= errors.get("general") %>
......@@ -221,8 +219,7 @@
<fmt:message key="setup.datasource.standard.failed_connect" />
<% } %>
</span>
</div>
<% } %>
......
<%@ page import="org.jivesoftware.wildfire.XMPPServer"%>
<%@ page import="org.jivesoftware.util.ParamUtils"%>
<%@ page import="org.jivesoftware.util.JiveGlobals"%>
<%@ page import="org.jivesoftware.util.JiveGlobals, java.util.Map, java.util.HashMap, org.jivesoftware.util.LocaleUtils"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
......@@ -14,26 +14,97 @@
%>
<%
String serverType;
String host;
int port = 389;
String baseDN;
String adminDN;
String adminPassword;
boolean connectionPoolEnabled = true;
boolean sslEnabled = false;
boolean debugEnabled = false;
boolean referralsEnabled = false;
// Get parameters
String serverType = ParamUtils.getParameter(request, "serverType");
String host = JiveGlobals.getXMLProperty("ldap.host");
if (ParamUtils.getParameter(request, "host") != null) {
host = ParamUtils.getParameter(request, "host");
}
boolean save = request.getParameter("save") != null;
Map<String, String> errors = new HashMap<String, String>();
boolean next = request.getParameter("continue") != null;
if (next) {
// Redirect
response.sendRedirect("setup-admin-settings.jsp");
return;
if (save) {
int serverTypeInt = ParamUtils.getIntParameter(request, "servertype", 1);
switch (serverTypeInt) {
case 1:
serverType = "other";
break;
case 2:
serverType = "activedirectory";
break;
case 3:
serverType = "openldap";
break;
default:
serverType = "other";
}
host = ParamUtils.getParameter(request, "host");
if (host == null) {
errors.put("host", LocaleUtils.getLocalizedString("setup.ldap.server.host_error"));
}
port = ParamUtils.getIntParameter(request, "port", port);
if (port <= 0) {
errors.put("port", LocaleUtils.getLocalizedString("setup.ldap.server.port_error"));
}
baseDN = ParamUtils.getParameter(request, "basedn");
if (baseDN == null) {
errors.put("baseDN", LocaleUtils.getLocalizedString("setup.ldap.server.basedn_error"));
}
adminDN = ParamUtils.getParameter(request, "admindn");
adminPassword = ParamUtils.getParameter(request, "adminpwd");
connectionPoolEnabled =
ParamUtils.getBooleanParameter(request, "connectionpool", connectionPoolEnabled);
sslEnabled = ParamUtils.getBooleanParameter(request, "ssl", sslEnabled);
debugEnabled = ParamUtils.getBooleanParameter(request, "debug", debugEnabled);
referralsEnabled = ParamUtils.getBooleanParameter(request, "referrals", referralsEnabled);
// Save settings and redirect
if (errors.isEmpty()) {
JiveGlobals.setXMLProperty("ldap.host", host);
JiveGlobals.setXMLProperty("ldap.port", Integer.toString(port));
JiveGlobals.setXMLProperty("ldap.baseDN", baseDN);
JiveGlobals.setXMLProperty("ldap.adminDN", adminDN);
JiveGlobals.setXMLProperty("ldap.adminPassword", adminPassword);
JiveGlobals.setXMLProperty("ldap.connectionPoolEnabled",
Boolean.toString(connectionPoolEnabled));
JiveGlobals.setXMLProperty("ldap.sslEnabled", Boolean.toString(sslEnabled));
JiveGlobals.setXMLProperty("ldap.debugEnabled", Boolean.toString(debugEnabled));
JiveGlobals
.setXMLProperty("ldap.autoFollowReferrals", Boolean.toString(referralsEnabled));
// Enable the LDAP auth provider. The LDAP user provider will be enabled on the next step.
JiveGlobals.setXMLProperty("provider.auth.className",
"org.jivesoftware.wildfire.ldap.LdapAuthProvider");
// Redirect to next step.
response.sendRedirect("setup-ldap-user.jsp?serverType=" + serverType);
return;
}
}
else {
// See if there are already values for the variables defined.
host = JiveGlobals.getXMLProperty("ldap.host");
port = JiveGlobals.getXMLProperty("ldap.port", port);
baseDN = JiveGlobals.getXMLProperty("ldap.baseDN");
adminDN = JiveGlobals.getXMLProperty("ldap.adminDN");
adminPassword = JiveGlobals.getXMLProperty("ldap.adminPassword");
connectionPoolEnabled =
JiveGlobals.getXMLProperty("ldap.connectionPoolEnabled", connectionPoolEnabled);
sslEnabled = JiveGlobals.getXMLProperty("ldap.sslEnabled", sslEnabled);
debugEnabled = JiveGlobals.getXMLProperty("ldap.debugEnabled", debugEnabled);
referralsEnabled = JiveGlobals.getXMLProperty("ldap.autoFollowReferrals", referralsEnabled);
}
%>
<html>
<head>
<title><fmt:message key="setup.ldap.server.title" /></title>
<meta name="currentStep" content="3"/>
</head>
<body>
......@@ -48,13 +119,23 @@
</div>
<!-- END jive-contentBox-stepbar -->
<!-- BEGIN jive-contentBox -->
<div class="jive-contentBox jive-contentBox_for-stepbar">
<!-- BEGIN jive-contentBox -->
<div class="jive-contentBox jive-contentBox_for-stepbar">
<h2><fmt:message key="setup.ldap.step_one" />: <span><fmt:message key="setup.ldap.connection_settings" /></span></h2>
<p><fmt:message key="setup.ldap.server.description" /></p>
<form action="" method="get">
<% if (errors.size() > 0) { %>
<div class="error">
<% for (String error:errors.values()) { %>
<%= error%><br/>
<% } %>
</div>
<% } %>
<form action="setup-ldap-server.jsp" method="post">
<!-- BEGIN jive-contentBox_bluebox -->
<div class="jive-contentBox_bluebox">
<table border="0" cellpadding="0" cellspacing="2">
......@@ -72,13 +153,13 @@
</tr>
<tr>
<td align="right"><fmt:message key="setup.ldap.server.host" />:</td>
<td><input type="text" name="host" id="jiveLDAPphost" size="22" maxlength="50"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.host_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 8000);"></a></span></td>
<td><input type="text" name="host" id="jiveLDAPphost" size="22" maxlength="50" value="<%= host!=null?host:"" %>"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.host_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 8000);"></a></span></td>
<td align="right">&nbsp;<fmt:message key="setup.ldap.server.port" />:</td>
<td><input type="text" name="port" id="jiveLDAPport" size="5" maxlength="5" value="389"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.port_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 8000);"></a></span></td>
<td><input type="text" name="port" id="jiveLDAPport" size="5" maxlength="5" value="<%= port %>"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.port_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 8000);"></a></span></td>
</tr>
<tr>
<td align="right"><fmt:message key="setup.ldap.server.basedn" />:</td>
<td colspan="3"><input type="text" name="basedn" id="jiveLDAPbasedn" size="40" maxlength="50"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.basedn_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 16000);"></a></span></td>
<td colspan="3"><input type="text" name="basedn" id="jiveLDAPbasedn" size="40" maxlength="50" value="<%= baseDN!=null?baseDN:""%>"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.basedn_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 16000);"></a></span></td>
</tr>
<tr><td colspan="4">&nbsp;</td></tr>
<tr>
......@@ -86,11 +167,11 @@
</tr>
<tr>
<td align="right"><fmt:message key="setup.ldap.server.admindn" />:</td>
<td colspan="3"><input type="text" name="admindn" id="jiveLDAPadmindn" size="40" maxlength="50"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.admindn_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', -1);"></a></span></td>
<td colspan="3"><input type="text" name="admindn" id="jiveLDAPadmindn" size="40" maxlength="50" value="<%= adminDN!=null?adminDN:""%>"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.admindn_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', -1);"></a></span></td>
</tr>
<tr>
<td align="right"><fmt:message key="setup.ldap.server.password" />:</td>
<td colspan="3"><input type="text" name="adminpwd" id="jiveLDAPadminpwd" size="22" maxlength="30"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.password_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 8000);"></a></span></td>
<td colspan="3"><input type="password" name="adminpwd" id="jiveLDAPadminpwd" size="22" maxlength="30" value="<%= adminPassword!=null?adminPassword:""%>"><span class="jive-setup-helpicon"><a href="" onmouseover="domTT_activate(this, event, 'content', '<fmt:message key="setup.ldap.server.password_help" />', 'styleClass', 'jiveTooltip', 'trail', true, 'delay', 300, 'lifetime', 8000);"></a></span></td>
</tr>
</table>
</div>
......@@ -124,10 +205,10 @@
<fmt:message key="setup.ldap.server.connection_pool_help" />
</td>
<td class="jive-advancedBorderBottom jive-advancedBorderRight" align="center">
<input type="radio" name="connectionpool" value="yes" checked>
<input type="radio" name="connectionpool" value="yes" <% if (connectionPoolEnabled) { %>checked <% } %>>
</td>
<td class="jive-advancedBorderBottom" align="center">
<input type="radio" name="connectionpool" value="no">
<input type="radio" name="connectionpool" value="no" <% if (!connectionPoolEnabled) { %>checked <% } %>>
</td>
</tr>
<tr>
......@@ -138,10 +219,10 @@
<fmt:message key="setup.ldap.server.ssl_help" />
</td>
<td class="jive-advancedBorderBottom jive-advancedBorderRight" align="center">
<input type="radio" name="ssl" value="yes">
<input type="radio" name="ssl" value="yes" <% if (sslEnabled) { %>checked <% } %>>
</td>
<td class="jive-advancedBorderBottom" align="center">
<input type="radio" name="ssl" value="no" checked>
<input type="radio" name="ssl" value="no" <% if (!sslEnabled) { %>checked <% } %>>
</td>
</tr>
<tr>
......@@ -152,52 +233,24 @@
<fmt:message key="setup.ldap.server.debug_help" />
</td>
<td class="jive-advancedBorderBottom jive-advancedBorderRight" align="center">
<input type="radio" name="debug" value="yes">
<input type="radio" name="debug" value="yes" <% if (debugEnabled) { %>checked <% } %>>
</td>
<td class="jive-advancedBorderBottom" align="center">
<input type="radio" name="debug" value="no" checked>
<input type="radio" name="debug" value="no" <% if (!debugEnabled) { %>checked <% } %>>
</td>
</tr>
<tr>
<td class="jive-advancedLabel" nowrap>
Follow Referrals:
<fmt:message key="setup.ldap.server.referral" />:
</td>
<td class="jive-advancedDesc jive-advancedBorderBottom jive-advancedBorderRight">
Automatically followed LDAP referrals
<fmt:message key="setup.ldap.server.referral_help" />
</td>
<td class="jive-advancedBorderBottom jive-advancedBorderRight" align="center">
<input type="radio" name="referrals" value="yes" checked>
<input type="radio" name="referrals" value="yes" <% if (referralsEnabled) { %>checked <% } %>>
</td>
<td class="jive-advancedBorderBottom" align="center">
<input type="radio" name="referrals" value="no">
</td>
</tr>
<tr>
<td class="jive-advancedLabel" nowrap>
Enclose UserDN:
</td>
<td class="jive-advancedDesc jive-advancedBorderBottom jive-advancedBorderRight">
&nbsp;
</td>
<td class="jive-advancedBorderBottom jive-advancedBorderRight" align="center">
<input type="radio" name="userdn" value="yes" checked>
</td>
<td class="jive-advancedBorderBottom" align="center">
<input type="radio" name="userdn" value="no">
</td>
</tr>
<tr>
<td class="jive-advancedLabel" nowrap>
Search in Subtrees:
</td>
<td class="jive-advancedDesc jive-advancedBorderRight">
&nbsp;
</td>
<td class="jive-advancedBorderRight" align="center">
<input type="radio" name="subtrees" value="yes" checked>
</td>
<td class="" align="center">
<input type="radio" name="subtrees" value="no">
<input type="radio" name="referrals" value="no" <% if (!referralsEnabled) { %>checked <% } %>>
</td>
</tr>
</tbody>
......@@ -210,20 +263,14 @@
<!-- BEGIN jive-buttons -->
<div class="jive-buttons">
<!-- BEGIN left-aligned buttons -->
<div align="left" style="float: left;">
<!--<input type="Submit" name="back" value="Back" id="jive-setup-back" border="0">-->
</div>
<!-- END left-aligned buttons -->
<!-- BEGIN right-aligned buttons -->
<div align="right">
<a href="setup-ldap-server_test.jsp" class="lbOn" id="jive-setup-test2">
<img src="../images/setup_btn_gearplay.gif" alt="" width="14" height="14" border="0">
Test Settings
<fmt:message key="setup.ldap.test" />
</a>
<input type="Submit" name="save" value="Save & Continue" id="jive-setup-save" border="0">
<input type="Submit" name="save" value="<fmt:message key="setup.ldap.continue" />" id="jive-setup-save" border="0">
</div>
<!-- END right-aligned buttons -->
......
......@@ -446,11 +446,20 @@ html>body .jive-vcardTable {
clear: both;
font-size: 11px;
}
.jive-error-text {
display: block;
clear: both;
color : #f00;
}
.error {
color : #900;
font-weight : bold;
background-color : #EDB9B1;
padding : 5px;
border: 1px solid #BB8888;
margin-top : 10px;
margin-bottom: 20px;
padding-left : 28px;
background-image : url(../../images/error-16x16.gif);
background-repeat : no-repeat;
background-position : 5px 5px;
-moz-border-radius: 3px;
}
.jive_setup_launchAdmin a,
.jive_setup_launchAdmin a:visited {
position: relative;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment