开发者

Using django with legacy authentication cookies

I have a large codebase in a homebrew python framework. I'm going to be gradually moving the code to Django, but in the meantime need to support logging in via the old开发者_如何学JAVA system. The old system uses a cookie to identify the user after they have logged in.

I don't want users to log in via Django, but I do want to be able to use @login_required as well as several apps that rely on Django's auth system, such as the admin, django-tagging and django-comments.

What's the best way to integrate the two auth systems? Both codebases are running within the same python process (via a wsgi middleware that switches apps per-request) and can load modules from each other as needed.


The easiest way to get it working is probably to use a custom authentication middleware in Django.

There are a couple of example authentication middlewares in Django: http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/middleware.py

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜