LDAP and Authkit

14 views
Skip to first unread message

jreg2k

unread,
Nov 25, 2009, 12:34:55 PM11/25/09
to AuthKit
Hi everybody,
i am trying to use authkit with my ldap server to authenticate users.

Can somebody show me the way to to this, and maybe some sample
code :)) .

Regards..


James

James Gardner

unread,
Nov 25, 2009, 3:51:59 PM11/25/09
to aut...@googlegroups.com
I've never done this personally but I believe others may have. If no-one
else can contribute any code your choices will be to write your own
permission objects to check specific things in LDAP manually or to
implement your own Users driver and use the existing permission objects.

James
> --
>
> You received this message because you are subscribed to the Google Groups "AuthKit" group.
> To post to this group, send email to aut...@googlegroups.com.
> To unsubscribe from this group, send email to authkit+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/authkit?hl=en.
>
>
>

James Regis

unread,
Nov 30, 2009, 8:37:40 AM11/30/09
to aut...@googlegroups.com
Thanks for your answer.

Can you give me some url on a skeleton to see how to implement this authit-ldap authentication ?

James


2009/11/25 James Gardner <ja...@pythonweb.org>



--
James

James Gardner

unread,
Dec 1, 2009, 6:12:27 AM12/1/09
to aut...@googlegroups.com
Sure, have a look in the source code directory for authkit.users:

https://hg.3aims.com/public/AuthKit/file/ea0d35d676da/AuthKit/trunk/authkit/users/

You have two choices for the API to use. The older API sets up an object
once and uses it throughout the lifetime of the application. This isn't
very useful. The new API (version 0.4) creates a new instance on each
request and passes in the environment. You can then get useful things
from the environment on each request.

If I were designing this now I'd set up some separate middleware which
creates an LDAP connection on each request and adds it to the environ as
environ['ldap.connection'] I'd then base my custom UsersFromLDAP driver
on the PostgreSQL one here:

https://hg.3aims.com/public/AuthKit/file/ea0d35d676da/AuthKit/trunk/authkit/users/postgresql_driver.py

BUT: rather than defining authkit_get_conn() and authkit_release_conn()
functions to get and release the connection, I'd simply use the LDAP
connection the middleware I'd written had set up because I could access
it as self.environ['ldap.connection']. Much neater.

Your custom class will need to be specified in the AuthKit config file
and will then get passed to the AddUsersObjectToEnviron middleware in
line 220 here:

https://hg.3aims.com/public/AuthKit/file/ea0d35d676da/AuthKit/trunk/authkit/authenticate/__init__.py

Then it will be initialised on each request in the class starting line 162.

Hope that helps,

James
> +unsub...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/authkit?hl=en.
> >
> >
> >
>
> --
>
> You received this message because you are subscribed to the
> Google Groups "AuthKit" group.
> To post to this group, send email to aut...@googlegroups.com.
> To unsubscribe from this group, send email to authkit
> +unsub...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/authkit?hl=en.
>
>
>
>
>
> --
> James
>
>
> --
>
> You received this message because you are subscribed to the Google
> Groups "AuthKit" group.
> To post to this group, send email to aut...@googlegroups.com.
> To unsubscribe from this group, send email to authkit
> +unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages