LDAP Authentication for Pyramid Web Applications
Tags: python
This is a brain dump of the state of LDAP authentication for Pyramid web applications as best I can discern. Send corrections and additions my way.
There are two ways of authenticating against an LDAP source referenced directly and indirectly in the Pyramid docs.
repoze.who.plugins.ldap via repoze.who and pyramid_who
There’s no explicit mention of LDAP support in the pyramid_who
documentation, but a search for “repoze.who ldap” comes up with the
repoze.who.plugins.ldap module
.
The last public commit on the repoze.who.plugins.ldap
module was
over three years ago on July 22, 2010, and the requirements listed for
the development branch explicitly request versions of repoze.who
greater than or equal to 1.0.6 and less than 2.0dev. The
repoze.who
library’s latest release is 2.2, so there’s probably a
bit of work to bring the LDAP plugin into the present.
The other end of the requirements chain is pyramid_who
itself.
This is the glue layer that wires repoze.who
into Pyramid web
applications, and it was last updated on April 2, 2012. Not quite
abandonware in the same way as the LDAP plugin, but the
last two commit messages are “hail mary” and “endless-piss-me-the-!@#$-off”.
It may still work, but I suspect it won’t be updated as Pyramid
continues to evolve.
pyramid_ldap
Initial investigation looks promising for pyramid_ldap
. It’s working
for user authentication against our Unix LDAP directory and our MS
Active Directory instances in the office.
A coworker had some trouble with group retrieval against our Active
Directory, but that wasn’t the library’s fault. Our distinguished
names look something like CN=Freund,
Timothy,OU=Employees,DC=example,DC=com
. That comma in our names is
the tricky bit. I don’t see many references to escaping inline commas,
so I suspect we’re in the minority for using CN
in our
distinguished names.
If you’re struggling with the same issue, here are two takes on it:
Django Authentication Using LDAP
LDAP authentication in Pyramid is the topic at hand. How does django-auth-ldap
enter into the mix at all? Because the Django folks look like they
have a really nice library for LDAP authentication.
The commit log is active.
They are aware of the multitude of LDAP group schemas.
A cursory look at the project shows that the LDAP code is fairly well
abstracted from the Django code. If pyramid_ldap
lets you down,
django-auth-ldap
may be a great place to find a solution to your problem.