Sure is. I've implemented it using
https://pythonhosted.org/django-auth-ldap/. It's just a matter of adding a
few settings to your settings.py and specifying the LDAP Backend as your
primary backend.
The hardest thing for me was working out the full DNs for authentication.
I normally use this code inside the shell to work out the details:
import ldap
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
l = ldap.initialize("ldaps://192.168.0.11:636")
l.set_option(ldap.OPT_REFERRALS, 0)
l.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
l.set_option(ldap.OPT_X_TLS,ldap.OPT_X_TLS_DEMAND)
l.set_option( ldap.OPT_X_TLS_DEMAND, True )
l.set_option( ldap.OPT_DEBUG_LEVEL, 255 )
baseDN = "o=somedomain"
searchScope = ldap.SCOPE_SUBTREE
retrieveAttributes = None
searchFilter = "cn=*usernamehere*"
ldap_result_id = l.search(baseDN, searchScope, searchFilter)
result_set = []
while 1:
result_type, result_data = l.result(ldap_result_id, 0)
if (result_data == []):
break
else:
if result_type == ldap.RES_SEARCH_ENTRY:
result_set.append(result_data)
print result_set
The LDAP admin person will have to give you:
- IP address of the LDAP server (in my case it's usually on their local
network e.g. ldaps://192.168.0.11:63)
- base DN e.g. baseDN = "o=somedomain"
- Test account of one of the users.
Django LDAP will normally get_or_create user and then add that user to the
groups it obtains from the LDAP.
I hope that helps!
M
P: +61 2 9281 3315
M: +61 415 193775
E: [email protected]
W: www.twoblokeswithapostie.com
On Tue, Nov 25, 2014 at 6:32 AM, Maripaz Guerrero Parrado <[email protected]>
wrote:
> I need to connect to the mezzanine with a user ldap, This is possible??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.