Revision: 3317
Author: seba.wagner
Date: Fri Aug 13 05:20:42 2010
Log: Fix multiple Ldap Configs
http://code.google.com/p/openmeetings/source/detail?r=3317
Modified:
/trunk/singlewebapp/WebContent/openmeetings/base/auth/checkLoginData.lzx
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/dao/LdapConfigDaoImpl.java
/trunk/singlewebapp/src/app/org/openmeetings/app/installation/ImportInitvalues.java
/trunk/singlewebapp/src/app/org/openmeetings/app/ldap/LdapLoginManagement.java
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/LdapConfigService.java
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/MainService.java
=======================================
---
/trunk/singlewebapp/WebContent/openmeetings/base/auth/checkLoginData.lzx
Thu Jul 29 10:04:42 2010
+++
/trunk/singlewebapp/WebContent/openmeetings/base/auth/checkLoginData.lzx
Fri Aug 13 05:20:42 2010
@@ -256,12 +256,51 @@
<labelText name="domain_label" text="Domain" width="200" y="174"
resize="false" x="2" />
<resetCombobox name="domain" width="230" y="174" x="120"
editable="false">
<handler name="oninit">
- this.addItem("localhost","localhost");
- this.addItem("eu.p-f.biz","SA-MeetingEU");
- this.addItem("am.p-f.biz","SA-MeetingAM");
- this.addItem("ap.p-f.biz","SA-MeetingAP");
- this.selectItemAt(0);
+ //this.addItem("localhost","localhost");
+ //this.addItem("eu.p-f.biz","SA-MeetingEU");
+ //this.addItem("am.p-f.biz","SA-MeetingAM");
+ //this.addItem("ap.p-f.biz","SA-MeetingAP");
+ //this.selectItemAt(0);
+ this.getActiveLdapConfigs.doCall();
</handler>
+
+ <!--
+ public List<LdapConfig> getActiveLdapConfigs()
+ -->
+ <netRemoteCallHib name="getActiveLdapConfigs"
funcname="ldapconfigservice.getActiveLdapConfigs"
+ remotecontext="$once{ canvas.thishib
}" >
+ <handler name="ondata" args="value">
+ //The onResult-Handler will be called be the
rtmpconnection
+ <![CDATA[
+ if ($debug)
Debug.write("getActiveLdapConfigs: ",value);
+ for (var i=0;i<value.length;i++) {
+
parent.addItem(value[i].name,value[i].ldapConfigId);
+ }
+
+ var t = new lz.sharedObject();
+ t.getLocal('userdata');
+ var g = t.getData('userdata');
+ if(g!=null) {
+ if (g["userdomain"]!=null) {
+
+ var tItem = this.getItem(g["userdomain"]);
+ if (tItem != null) {
+ parent.selectItem(g["userdomain"]);
+ } else {
+ parent.selectItemAt(0);
+ }
+
+ } else {
+ parent.selectItemAt(0);
+ }
+ } else {
+ parent.selectItemAt(0);
+ }
+
+ ]]>
+ </handler>
+ </netRemoteCallHib>
+
</resetCombobox>
<labelText name="organisation_label_info" labelid="617" width="350"
@@ -318,7 +357,7 @@
<netparam><method name="getValue"> return
parent.parent.userpass.getText(); </method></netparam>
<netparam><method name="getValue"> return
parent.parent._savelogindata.getValue(); </method></netparam>
<netparam><method name="getValue"> return
Number(parent.parent.languages.getValue()); </method></netparam>
- <netparam><method name="getValue"> return
parent.parent.domain.getText(); </method></netparam>
+ <netparam><method name="getValue"> return
Number(parent.parent.domain.getValue()); </method></netparam>
<handler name="ondata" args="value">
<![CDATA[
//The onResult-Handler will be called be the rtmpconnection
@@ -336,6 +375,7 @@
g["userquality"] = parent.ncomboquality.getValue();
g["usercolor"] = parent.colors.getValue();
g["userlang"] = parent.languages.getValue();
+ g["userdomain"] = parent.domain.getValue();
g["saveuserdata"]=true;
g["storedSession"] = canvas.sessionId;
t.setData('userdata',g);
@@ -350,6 +390,7 @@
g["userquality"] = null;
g["usercolor"] = null;
g["userlang"] = null;
+ g["userdomain"] = null;
g["saveuserdata"]=false;
g["storedSession"] = "";
t.setData('userdata',g);
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/dao/LdapConfigDaoImpl.java
Fri Aug 13 04:44:12 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/dao/LdapConfigDaoImpl.java
Fri Aug 13 05:20:42 2010
@@ -21,6 +21,18 @@
private static final Logger log =
Red5LoggerFactory.getLogger(LdapConfigDaoImpl.class,
ScopeApplicationAdapter.webAppRootKey);
+ private LdapConfigDaoImpl() {
+ }
+
+ private static LdapConfigDaoImpl instance = null;
+
+ public static synchronized LdapConfigDaoImpl getInstance() {
+ if (instance == null) {
+ instance = new LdapConfigDaoImpl();
+ }
+ return instance;
+ }
+
public Long addLdapConfig(String name, Boolean addDomainToUserName,
String configFileName,
String domain, Long insertedby, Boolean isActive) {
try {
@@ -208,5 +220,32 @@
}
return null;
}
+
+ public List<LdapConfig> getActiveLdapConfigs() {
+ try {
+ log.debug("selectMaxFromConfigurations ");
+
+ String hql = "select c from LdapConfig c " +
+ "where c.deleted LIKE 'false' " +
+ "AND c.isActive = :isActive ";
+
+ //get all users
+ Object idf = HibernateUtil.createSession();
+ Session session = HibernateUtil.getSession();
+ Transaction tx = session.beginTransaction();
+ Query query = session.createQuery(hql);
+ query.setBoolean("isActive", true);
+ List<LdapConfig> ll = query.list();
+ tx.commit();
+ HibernateUtil.closeSession(idf);
+
+ return ll;
+ } catch (HibernateException ex) {
+ log.error("[getActiveLdapConfigs] ",ex);
+ } catch (Exception ex2) {
+ log.error("[getActiveLdapConfigs] ",ex2);
+ }
+ return null;
+ }
}
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/installation/ImportInitvalues.java
Wed Aug 11 14:49:22 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/installation/ImportInitvalues.java
Fri Aug 13 05:20:42 2010
@@ -232,8 +232,9 @@
null,
"This Class is used for Authentification-Crypting. Be carefull what
you do here! If you change it while running previous Pass of users will not
be workign anymore! for more Information see
http://code.google.com/p/openmeetings/wiki/CustomCryptMechanism");
//"1"
- Configurationmanagement.getInstance().addConfByKey(3,
- "ldap_config_path", ldap_auth_path, null, "Absolute Path to a Ldap
Configration File(see example config)");
+ //Not needed anymore, see the LDAP Configuration in the Administration
section
+// Configurationmanagement.getInstance().addConfByKey(3,
+// "ldap_config_path", ldap_auth_path, null, "Absolute Path to a Ldap
Configration File(see example config)");
Configurationmanagement.getInstance().addConfByKey(3,
"screen_viewer", screen_viewer, null, "ScreenViewer Type(0==standard,
1== jrdesktop)");
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/ldap/LdapLoginManagement.java
Thu Jul 29 10:04:42 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/ldap/LdapLoginManagement.java
Fri Aug 13 05:20:42 2010
@@ -10,11 +10,13 @@
import org.openmeetings.app.data.basic.Configurationmanagement;
import org.openmeetings.app.data.basic.Sessionmanagement;
+import org.openmeetings.app.data.basic.dao.LdapConfigDaoImpl;
import org.openmeetings.app.data.user.Organisationmanagement;
import org.openmeetings.app.data.user.Statemanagement;
import org.openmeetings.app.data.user.Usermanagement;
import org.openmeetings.app.hibernate.beans.adresses.States;
import org.openmeetings.app.hibernate.beans.basic.Configuration;
+import org.openmeetings.app.hibernate.beans.basic.LdapConfig;
import org.openmeetings.app.hibernate.beans.recording.RoomClient;
import org.openmeetings.app.hibernate.beans.user.Users;
import org.openmeetings.app.ldap.config.ConfigReader;
@@ -123,12 +125,14 @@
* Ldap Password Synch to OM DB set active ?
* defaults to true in case of error so as to keep old behaviour
*/
- public boolean getLdapPwdSynchStatus(String domain){ //TIBO
+ public boolean getLdapPwdSynchStatus(Long ldapConfigId){ //TIBO
// Retrieve Configuration Data
HashMap<String, String> configData;
+ LdapConfig ldapConfig =
LdapConfigDaoImpl.getInstance().getLdapConfigById(ldapConfigId);
+
try{
- configData= getLdapConfigData(domain);
+ configData=
getLdapConfigData(ldapConfig.getConfigFileName());
}catch(Exception e){
log.error("Error on getLdapPwdSynchStatus : " +
e.getMessage());
return true;
@@ -181,7 +185,7 @@
* Retrieving LdapData from Config
*/
//----------------------------------------------------------------------------------------
- public HashMap<String, String> getLdapConfigData(String domain) throws
Exception{
+ public HashMap<String, String> getLdapConfigData(String
ldapConfigfileName) throws Exception{
log.debug("LdapLoginmanagement.getLdapConfigData");
// Retrieving Path to Config
@@ -196,7 +200,7 @@
String path = ScopeApplicationAdapter.webAppPath
+ File.separatorChar + "conf" +
File.separatorChar
- + domain + ".conf";
+ + ldapConfigfileName;
return readConfig(path);
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/LdapConfigService.java
Wed Aug 11 14:49:22 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/LdapConfigService.java
Fri Aug 13 05:20:42 2010
@@ -1,6 +1,8 @@
package org.openmeetings.app.remote;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;
@@ -48,6 +50,31 @@
}
return null;
}
+
+ public List<LdapConfig> getActiveLdapConfigs() {
+ try {
+ List<LdapConfig> ldapConfigs =
this.ldapConfigDaoImpl.getActiveLdapConfigs();
+
+ //Add localhost Domain
+ LdapConfig ldapConfig = new LdapConfig();
+
+ ldapConfig.setName("localhost");
+ ldapConfig.setLdapConfigId(-1);
+
+ List<LdapConfig> returnldapConfigs = new
LinkedList<LdapConfig>();
+ returnldapConfigs.add(ldapConfig);
+
+ for (LdapConfig ldapConfigStored : ldapConfigs) {
+ returnldapConfigs.add(ldapConfigStored);
+ }
+
+ return returnldapConfigs;
+
+ } catch (Exception err) {
+ log.error("[getActiveLdapConfigs]",err);
+ }
+ return null;
+ }
/**
*
=======================================
---
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/MainService.java
Wed Aug 11 06:27:54 2010
+++
/trunk/singlewebapp/src/app/org/openmeetings/app/remote/MainService.java
Fri Aug 13 05:20:42 2010
@@ -19,6 +19,7 @@
import org.red5.server.api.service.IServiceCapableConnection;
import org.openmeetings.app.hibernate.beans.adresses.States;
import org.openmeetings.app.hibernate.beans.basic.Configuration;
+import org.openmeetings.app.hibernate.beans.basic.LdapConfig;
import org.openmeetings.app.hibernate.beans.basic.SOAPLogin;
import org.openmeetings.app.hibernate.beans.basic.Sessiondata;
@@ -38,6 +39,7 @@
import org.openmeetings.app.data.conference.Feedbackmanagement;
import org.openmeetings.app.data.conference.Roommanagement;
import org.openmeetings.app.data.basic.AuthLevelmanagement;
+import org.openmeetings.app.data.basic.dao.LdapConfigDaoImpl;
import org.openmeetings.app.data.basic.dao.SOAPLoginDaoImpl;
import org.openmeetings.app.remote.red5.ClientListManager;
import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
@@ -253,7 +255,7 @@
* @param Userpass
* @return a valid user account or an empty user with an error message
and level -1
*/
- public Object loginUser(String SID, String usernameOrEmail, String
Userpass, Boolean storePermanent, Long language_id, String domain){
+ public Object loginUser(String SID, String usernameOrEmail, String
Userpass, Boolean storePermanent, Long language_id, Long ldapConfigId){
// Check, whether LDAP - Login is required(Configuration has key
ldap_config_path
boolean withLdap = false;
@@ -262,7 +264,7 @@
// withLdap = true;
// }
- if (!domain.equals("localhost")) {
+ if (ldapConfigId > 0) {
withLdap = true;
}
@@ -274,19 +276,19 @@
Users user =
Usermanagement.getInstance().getUserByLoginOrEmail(usernameOrEmail);
// AdminUser werden auf jeden Fall lokal authentifiziert
- if(user != null){ // User exists in local DB
- if (user.getExternalUserType() ==null || !
user.getExternalUserType().equals(EXTERNAL_USER_TYPE_LDAP)){ // User is not
of External Type LDAP
- log.debug("User " + usernameOrEmail + " is local user -> Use
Internal DB");
- withLdap = false;
- }
- else if(user.getLevel_id() >=3 &&
LdapLoginManagement.getInstance().getLdapPwdSynchStatus(domain) == true){
// User is admin with pwd synch
- log.debug("User " + usernameOrEmail + " : Ldap-user has admin
rights -> Use Internal DB");
- withLdap = false;
- }
- else{
- log.debug("User " + usernameOrEmail + " : Ldap user authenticated
using Ldap");
- }
- }
+// if(user != null){ // User exists in local DB
+// if (user.getExternalUserType() ==null || !
user.getExternalUserType().equals(EXTERNAL_USER_TYPE_LDAP)){ // User is not
of External Type LDAP
+// log.debug("User " + usernameOrEmail + " is local user -> Use
Internal DB");
+// withLdap = false;
+// }
+// else if(user.getLevel_id() >=3 &&
LdapLoginManagement.getInstance().getLdapPwdSynchStatus(ldapConfigId) ==
true){ // User is admin with pwd synch
+// log.debug("User " + usernameOrEmail + " : Ldap-user has admin
rights -> Use Internal DB");
+// withLdap = false;
+// }
+// else{
+// log.debug("User " + usernameOrEmail + " : Ldap user
authenticated using Ldap");
+// }
+// }
RoomClient currentClient;
IConnection current = Red5.getConnectionLocal();
@@ -300,7 +302,14 @@
//LDAP Loggedin Users cannot use the permanent Login
Flag
- o =
LdapLoginManagement.getInstance().doLdapLogin(usernameOrEmail+"@"+domain,
Userpass, currentClient, SID, domain);
+ LdapConfig ldapConfig =
LdapConfigDaoImpl.getInstance().getLdapConfigById(ldapConfigId);
+
+ String ldapLogin = usernameOrEmail;
+ if (ldapConfig.getAddDomainToUserName() != null &&
ldapConfig.getAddDomainToUserName()) {
+ ldapLogin =
usernameOrEmail+"@"+ldapConfig.getDomain();
+ }
+
+ o = LdapLoginManagement.getInstance().doLdapLogin(ldapLogin,
Userpass, currentClient, SID, ldapConfig.getConfigFileName());
// o =
LdapLoginManagement.getInstance().doLdapLogin(usernameOrEmail, Userpass,
currentClient, SID,
//
false, language_id);
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en.