|
From: | Tarik Dadi |
Subject: | [GMG-Devel] LDAP plugin Mediagoblin |
Date: | Sat, 1 Mar 2014 23:36:00 +0100 |
Hello guys, I just discovered recently the mediagoblin project and i love it. I then wanted to use it with LDAP authentification, unfortunately it seems that the LDAP plugin is not complete. My LDAP configuration needs the following parameters in the mediagobelin.ini file : # LDAP AUTH [[mediagoblin.plugins.ldap]] [[[EISTI]]] LDAP_SERVER_URI = 'ldap://ldap.eisti.fr' LDAP_BIND_DN = "cn=webuser,dc=eisti,dc=fr » LDAP_BIND_PW = "pwebalc! » LDAP_SEARCH_BASE = 'ou=People,dc=eisti,dc=fr’ LDAP_SEARCH_FILTER = '(uid={0})’ EMAIL_SEARCH_FIELD = 'mail’ LDAP_SEARCH_BASE = 'ou=people,dc=eisti,dc=fr, ldap.SCOPE_SUBTREE, (uid=%(user)s)’ #LDAP_USER_DN_TEMPLATE = 'cn={webuser},ou=people,dc=eisti,dc=fr' And I believe that improvement are needed in the tools.py file of the LDAP plugin : # New function def _login_template(self, server, username, password): pass #New function def _login_dblbind(self, server, username, password): pass def login(self, username, password): for k, v in self.ldap_settings.iteritems(): # Here, we should adapt to the LDAP server, if there is a search_filter and a bind_dn & bind_pw, an anonymous bind + research # If the USER_DN_TEMPLATE attribut is present we should use the template method try: self._connect(v) user_dn = v['LDAP_USER_DN_TEMPLATE'].format(username=username) self.conn.simple_bind_s(user_dn, password.encode('utf8')) email = self._get_email(v, username) return username, email except ldap.LDAPError, e: _log.info(e) finally: _log.info('Unbinding {0}.'.format(v['LDAP_SERVER_URI'])) self.conn.unbind() return False, None I’m new to python/django programming, i don’t know if the ideas that I’ve given are worthy. So if there is someone who knows more… Thank you |
[Prev in Thread] | Current Thread | [Next in Thread] |