Author: solomax
Date: Fri May 17 18:13:25 2013
New Revision: 1483938
URL: http://svn.apache.org/r1483938
Log:
[OPENMEETINGS-620] LDAP login is verified to work as expected;
code clean-up;
Modified:
openmeetings/trunk/singlewebapp/docs/LdapAndADS.html
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapAuthBase.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.html
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInDialog.java
openmeetings/trunk/singlewebapp/xdocs/LdapAndADS.xml
Modified: openmeetings/trunk/singlewebapp/docs/LdapAndADS.html
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/docs/LdapAndADS.html?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/docs/LdapAndADS.html (original)
+++ openmeetings/trunk/singlewebapp/docs/LdapAndADS.html Fri May 17 18:13:25
2013
@@ -642,6 +642,58 @@ limitations under the License.
<table
border="0" cellspacing="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td ><!-- bgcolor="#EEEEEE" -->
<font color="#000000" face="verdana,arial,helvetica,sanserif">
+ <a name="Ubuntu Installation"><strong>Ubuntu
Installation</strong></a>
+ </font>
+ <hr style="width:100%; color:#999999; background-color:#999999;
height:1px; border:0px;"/>
+ </td></tr>
+ <tr><td>
+ <blockquote>
+ <div>
+ Run the commands
+ <blockquote>
+ <i>
+ sudo apt-get install slapd
ldap-utils
+ </i>
+ </blockquote>
+ </div>
+ <div>
+ Modify file <tt>/etc/ldap/ldap.conf</tt> add
highlighted attributes:
+ <blockquote>
+ <i>
+ #<br />
+ # LDAP Defaults<br />
+ #<br />
+ # See ldap.conf(5) for
details<br />
+ # This file should be world
readable but not world writable.<br />
+ <b>BASE dc=unixmen,dc=com<br
/>
+ URI
ldap://192.168.1.200</b><br />
+ #SIZELIMIT 12<br />
+ #TIMELIMIT 15<br />
+ #DEREF never<br />
+ # TLS certificates (needed for
GnuTLS)<br />
+ TLS_CACERT
/etc/ssl/certs/ca-certificates.crt<br />
+ </i>
+ </blockquote>
+ </div>
+ <div>
+ Run the Configuration assistant: <tt>sudo
dpkg-reconfigure slapd</tt>
+ </div>
+ <div>
+ Test LDAP server: <tt>ldapsearch -x</tt>
+ </div>
+ <div>
+ Add/Edit/Delete users: <tt>sudo apt-get install
phpldapadmin</tt>
+ </div>
+ <div>
+ Detailed reference: <a
href="http://www.unixmen.com/openldap-installation-and-configuration-in-ubuntu-12-10-server-debian-6/">http://www.unixmen.com/openldap-installation-and-configuration-in-ubuntu-12-10-server-debian-6/</a>
+ </div>
+ </blockquote>
+ </td></tr>
+ <tr><td><br/></td></tr>
+ </table>
+ <table border="0"
cellspacing="0" cellpadding="0" cellspacing="0" width="100%">
+ <tr><td ><!-- bgcolor="#EEEEEE" -->
+ <font color="#000000" face="verdana,arial,helvetica,sanserif">
<a name="LDAP and Active Directory Integration"><strong>LDAP and
Active Directory Integration</strong></a>
</font>
<hr style="width:100%; color:#999999; background-color:#999999;
height:1px; border:0px;"/>
@@ -649,7 +701,6 @@ limitations under the License.
<tr><td>
<blockquote>
<p> In:
$RED5_HOME/webapps/openmeetings/conf<br />
-
you will find sample configurations for LDAP
and Active Directory. The
nature of those Directory Servers are that they
are individual for
every organization, so you have to modify of
course at least the
@@ -659,8 +710,8 @@ limitations under the License.
OpenMeetings, goto Administration > Ldap.
</p>
<a class="fancybox-buttons"
href="images/ldap_screen.png">
- <img src="images/ldap_screen.png"
alt="" width="442" height="282" />
- </a>
+ <img src="images/ldap_screen.png" alt=""
width="442" height="282" />
+ </a>
<p>
Import is that you configure LDAP_SEARCH_PATH
so that it points to the node of your directory server that contains the users
</p>
@@ -673,6 +724,9 @@ limitations under the License.
<p>
You can configure multiple domains or different
user-paths in the Administration of OpenMeetings.
</p>
+ <p>
+ <b>NOTE: </b>You should specify file name
<i>RELATIVE</i> to <tt>$RED5_HOME/webapps/openmeetings/conf</tt>
+ </p>
</blockquote>
</td></tr>
<tr><td><br/></td></tr>
Modified:
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapAuthBase.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapAuthBase.java?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapAuthBase.java
(original)
+++
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapAuthBase.java
Fri May 17 18:13:25 2013
@@ -109,9 +109,9 @@ public class LdapAuthBase {
ldapAuthenticateProperties.put(Context.SECURITY_CREDENTIALS,
passwd);
ldapAuthenticateProperties.put("java.naming.ldap.referral.bind",
"true");
-
- if(ldap_admin_dn == null)
+ if(ldap_admin_dn == null) {
ldap_admin_dn = "";
+ }
if(!ldap_auth_type.equals(LDAP_AUTH_TYPE_NONE) &&
ldap_admin_dn.length() > 0){
log.debug("\n\nAuthentification to LDAP - Server start");
Modified:
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
(original)
+++
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
Fri May 17 18:13:25 2013
@@ -308,19 +308,14 @@ public class LdapLoginManagement {
***/
// Get custom Ldap attributes mapping
- String ldap_user_attr_lastname = configData
- .get(CONFIGKEY_LDAP_KEY_LASTNAME);
- String ldap_user_attr_firstname = configData
- .get(CONFIGKEY_LDAP_KEY_FIRSTNAME);
+ String ldap_user_attr_lastname =
configData.get(CONFIGKEY_LDAP_KEY_LASTNAME);
+ String ldap_user_attr_firstname =
configData.get(CONFIGKEY_LDAP_KEY_FIRSTNAME);
String ldap_user_attr_mail =
configData.get(CONFIGKEY_LDAP_KEY_MAIL);
- String ldap_user_attr_street = configData
- .get(CONFIGKEY_LDAP_KEY_STREET);
- String ldap_user_attr_additional_name = configData
- .get(CONFIGKEY_LDAP_KEY_ADDITIONAL_NAME);
+ String ldap_user_attr_street =
configData.get(CONFIGKEY_LDAP_KEY_STREET);
+ String ldap_user_attr_additional_name =
configData.get(CONFIGKEY_LDAP_KEY_ADDITIONAL_NAME);
String ldap_user_attr_fax =
configData.get(CONFIGKEY_LDAP_KEY_FAX);
String ldap_user_attr_zip =
configData.get(CONFIGKEY_LDAP_KEY_ZIP);
- String ldap_user_attr_country = configData
- .get(CONFIGKEY_LDAP_KEY_COUNTRY);
+ String ldap_user_attr_country =
configData.get(CONFIGKEY_LDAP_KEY_COUNTRY);
String ldap_user_attr_town =
configData.get(CONFIGKEY_LDAP_KEY_TOWN);
String ldap_user_attr_phone =
configData.get(CONFIGKEY_LDAP_KEY_PHONE);
String ldap_user_attr_timezone =
configData.get(CONFIGKEY_LDAP_TIMEZONE_NAME);
@@ -372,8 +367,9 @@ public class LdapLoginManagement {
// Auth Type
String ldap_auth_type =
configData.get(CONFIGKEY_LDAP_AUTH_TYPE);
- if (ldap_auth_type == null)
+ if (ldap_auth_type == null) {
ldap_auth_type = "";
+ }
if (!isValidAuthType(ldap_auth_type)) {
log.error("ConfigKey in Ldap Config contains invalid
auth type : '"
@@ -383,19 +379,16 @@ public class LdapLoginManagement {
}
// Filter for Search of UserData
- String ldap_search_filter = "(" + ldap_fieldname_user_principal
+ "="
- + user + ")";
+ String ldap_search_filter = "(" + ldap_fieldname_user_principal
+ "=" + user + ")";
- log.debug("Searching userdata with LDAP Search Filter :"
- + ldap_search_filter);
+ log.debug("Searching userdata with LDAP Search Filter :" +
ldap_search_filter);
// replace : -> in config = are replaced by : to be able to
build valid
// key=value pairs
ldap_search_scope = ldap_search_scope.replaceAll(":", "=");
ldap_admin_dn = ldap_admin_dn.replaceAll(":", "=");
- LdapAuthBase lAuth = new LdapAuthBase(ldap_url, ldap_admin_dn,
- ldap_passwd, ldap_auth_type);
+ LdapAuthBase lAuth = new LdapAuthBase(ldap_url, ldap_admin_dn,
ldap_passwd, ldap_auth_type);
log.debug("authenticating admin...");
lAuth.authenticateUser(ldap_admin_dn, ldap_passwd);
@@ -409,8 +402,7 @@ public class LdapLoginManagement {
HashMap<String, String> uidCnDictionary =
lAuth.getUidCnHashMap(
ldap_search_scope, ldap_search_filter,
ldap_fieldname_user_principal);
if (uidCnDictionary.get(user) != null) {
- ldapUserDN = uidCnDictionary.get(user) + ","
- + ldap_search_scope;
+ ldapUserDN = uidCnDictionary.get(user) + "," +
ldap_search_scope;
log.debug("Authentication with DN: " +
ldapUserDN);
}
try {
@@ -424,8 +416,9 @@ public class LdapLoginManagement {
}
} else {
try {
- if (!lAuth.authenticateUser(user, passwd))
+ if (!lAuth.authenticateUser(user, passwd)) {
return new Long(-11);
+ }
} catch (Exception e) {
log.error("Error on LdapAuth : " +
e.getMessage());
return null;
@@ -438,7 +431,6 @@ public class LdapLoginManagement {
try {
u = userManager.getUserByLogin(user);
-
} catch (Exception e) {
log.error("Error retrieving Userdata : " +
e.getMessage());
}
Modified:
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
(original)
+++
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/persistence/beans/basic/LdapConfig.java
Fri May 17 18:13:25 2013
@@ -63,7 +63,7 @@ public class LdapConfig implements Seria
@Column(name="add_domain_to_user_name")
@Element(data=true)
- public Boolean addDomainToUserName;
+ public boolean addDomainToUserName;
@Column(name="domain")
@Element(data=true)
@@ -71,7 +71,7 @@ public class LdapConfig implements Seria
@Column(name="is_active")
@Element(data=true)
- public Boolean isActive;
+ public boolean isActive;
@Column(name="inserted")
public Date inserted;
@@ -118,10 +118,10 @@ public class LdapConfig implements Seria
this.configFileName = configFileName;
}
- public Boolean getAddDomainToUserName() {
+ public boolean getAddDomainToUserName() {
return addDomainToUserName;
}
- public void setAddDomainToUserName(Boolean addDomainToUserName) {
+ public void setAddDomainToUserName(boolean addDomainToUserName) {
this.addDomainToUserName = addDomainToUserName;
}
@@ -132,10 +132,10 @@ public class LdapConfig implements Seria
this.domain = domain;
}
- public Boolean getIsActive() {
+ public boolean getIsActive() {
return isActive;
}
- public void setIsActive(Boolean isActive) {
+ public void setIsActive(boolean isActive) {
this.isActive = isActive;
}
@@ -181,5 +181,4 @@ public class LdapConfig implements Seria
public void setComment(String comment) {
this.comment = comment;
}
-
}
Modified:
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
(original)
+++
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/remote/MainService.java
Fri May 17 18:13:25 2013
@@ -329,8 +329,7 @@ public class MainService implements IPen
LdapConfig ldapConfig =
ldapConfigDao.get(ldapConfigId);
String ldapLogin = usernameOrEmail;
- if (ldapConfig.getAddDomainToUserName() != null
- &&
ldapConfig.getAddDomainToUserName()) {
+ if (ldapConfig.getAddDomainToUserName()) {
ldapLogin = usernameOrEmail + "@" +
ldapConfig.getDomain();
}
Modified:
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.html
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.html?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.html
(original)
+++
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/admin/ldaps/LdapsPanel.html
Fri May 17 18:13:25 2013
@@ -88,7 +88,7 @@
<label><wicket:ommessage
key="1117" /></label><input type="checkbox" class="formcheckbox"
wicket:id="addDomainToUserName"/>
</div>
<div class="formelement">
- <label><wicket:ommessage key="1115"
/></label><input type="text" wicket:id="domain"/>
+ <label><wicket:ommessage key="1118"
/></label><input type="text" wicket:id="domain"/>
</div>
<div class="formelement">
<label><wicket:ommessage key="270"
/></label><textarea wicket:id="comment"/>
Modified:
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInDialog.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInDialog.java?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInDialog.java
(original)
+++
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInDialog.java
Fri May 17 18:13:25 2013
@@ -167,6 +167,9 @@ public class SignInDialog extends Abstra
@Override
protected void onSubmit(AjaxRequestTarget target) {
ldapConfigFileName = domain.getConfigFileName() == null ? "" :
domain.getConfigFileName();
+ if (domain.getAddDomainToUserName()) {
+ login = login + "@" + domain.getDomain();
+ }
OmAuthenticationStrategy strategy = getAuthenticationStrategy();
if (WebSession.get().signIn(login, password,
ldapConfigFileName)) {
setResponsePage(Application.get().getHomePage());
Modified: openmeetings/trunk/singlewebapp/xdocs/LdapAndADS.xml
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/xdocs/LdapAndADS.xml?rev=1483938&r1=1483937&r2=1483938&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/xdocs/LdapAndADS.xml (original)
+++ openmeetings/trunk/singlewebapp/xdocs/LdapAndADS.xml Fri May 17 18:13:25
2013
@@ -22,11 +22,49 @@
</properties>
<body>
-
+ <section name="Ubuntu Installation">
+ <div>
+ Run the commands
+ <blockquote>
+ <i>
+ sudo apt-get install slapd
ldap-utils
+ </i>
+ </blockquote>
+ </div>
+ <div>
+ Modify file <tt>/etc/ldap/ldap.conf</tt> add
highlighted attributes:
+ <blockquote>
+ <i>
+ #<br />
+ # LDAP Defaults<br />
+ #<br />
+ # See ldap.conf(5) for
details<br />
+ # This file should be world
readable but not world writable.<br />
+ <b>BASE dc=unixmen,dc=com<br
/>
+ URI
ldap://192.168.1.200</b><br />
+ #SIZELIMIT 12<br />
+ #TIMELIMIT 15<br />
+ #DEREF never<br />
+ # TLS certificates (needed for
GnuTLS)<br />
+ TLS_CACERT
/etc/ssl/certs/ca-certificates.crt<br />
+ </i>
+ </blockquote>
+ </div>
+ <div>
+ Run the Configuration assistant: <tt>sudo
dpkg-reconfigure slapd</tt>
+ </div>
+ <div>
+ Test LDAP server: <tt>ldapsearch -x</tt>
+ </div>
+ <div>
+ Add/Edit/Delete users: <tt>sudo apt-get install
phpldapadmin</tt>
+ </div>
+ <div>
+ Detailed reference: <a
href="http://www.unixmen.com/openldap-installation-and-configuration-in-ubuntu-12-10-server-debian-6/">http://www.unixmen.com/openldap-installation-and-configuration-in-ubuntu-12-10-server-debian-6/</a>
+ </div>
+ </section>
<section name="LDAP and Active Directory Integration">
-
<p> In: $RED5_HOME/webapps/openmeetings/conf<br/>
-
you will find sample configurations for LDAP
and Active Directory. The
nature of those Directory Servers are that they
are individual for
every organization, so you have to modify of
course at least the
@@ -35,27 +73,24 @@
To activate any of those configurations you
have to login into
OpenMeetings, goto Administration > Ldap.
</p>
-
<a class="fancybox-buttons"
href="images/ldap_screen.png">
- <img src="images/ldap_screen.png"
alt="" width="442" height="282" />
- </a>
-
+ <img src="images/ldap_screen.png" alt=""
width="442" height="282" />
+ </a>
<p>
Import is that you configure LDAP_SEARCH_PATH
so that it points to the node of your directory server that contains the users
</p>
-
<p>
If you have multiple search paths you can
either try to define a search path that points to multiple nodes or define
multiple ldap configurations.
</p>
-
<p>
Successful integration is also reported with
Novell eDirectory
</p>
-
<p>
You can configure multiple domains or different
user-paths in the Administration of OpenMeetings.
</p>
-
+ <p>
+ <b>NOTE: </b>You should specify file name
<i>RELATIVE</i> to <tt>$RED5_HOME/webapps/openmeetings/conf</tt>
+ </p>
</section>
</body>