On 1/17/06, tonemcd <[EMAIL PROTECTED]> wrote:
Seriously, this is a major thing for any kind of migration we have in
mind from Zope -> Django, so any thoughts on how to do this would be
greatly appreciated.

Hi,

In my personal experience, django authentication framework is very thin, and you can bypass it completely without much penalty and use one of your own.

What you get by django anuthentication is @login_required, request.user and user auto variable in DjangoContext Context for templates. The internals or request.user magic is pretty trivial, request.session[users.SESSION_KEY] is queried to get the user_id, and request.user is initialized with corresponding user.

If you are ready to

  • write a @ldap_login_required decorator which make sure request.session[users.SESSION_KEY] is a valid ldap user id, or redirects to you custom login page
  • write a check_password_and_get_id_else_exception(username, password) to be used by login handling view, which sets the returned id to request.session[users.SESSION_KEY]
  • use get_ldap_user(request) instead of request.user, and
  • manually set the the user variable in the django context,
you are done, that is almost all you need. Please don't let lack of features in defauld django authentication framework deter you from using the rest of it.

We need better documentation to instill confidence in developers for the same, but what django provides is very simiplistic and you can write your custom authentication etc very easily.

Also read: http://nerdierthanthou.nfshost.com/2006/01/django-tips.html

--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701

Reply via email to