Authenticate Trac against Django
I am no longer maintaining this. If you would like to take over, please feel free to.
I've worked up the beginnings of a Trac plugin that authenticates against Django users. I've since determined that I'm not likely to use it. So, if anyone is interested in maintaining it, feel free.
The basic functionality works. I can login to my django app and then I'm instantly logged into trac (without retyping my username and password). If I log out of my django app, I'm instantly logged out of trac.
It works by getting the django session from the django cookie and extracting the user from the django database. Of course, for this to work, both the trac and django instances need to be on the same machine (to access eachother) and behind the same domain (to access the cookie). I also have the beginnings of some code to assign permissions within django for trac via django's user groups. For some undetermined reason I haven't been able to override the login/out links in the nav and there's some debug code that needs removed.
A sample_trac.ini file that only contains the relevant settings has been included.
Note: I have not committed anything to svn. Scroll down to the bottom for the attached file.
I have attached some updated versions submitted to me by others (see below). I have not tested them and am not using this anymore. Use at your own risk.
If you have any issues, create a new ticket.
Download the zipped source from here.
Install the plugin and add the following settings to trac.ini:
[components] djangoauth.* = enabled [djangoauth] django_settings_module = myproject.settings use_django_perms = false login_url = /login/ logout_url = /logout/
- django_settings_module should point to the django settings file that is used for your project. The file needs to be on your pythonpath and importable.
- use_django_perms turns on or off the ability to set permission within the django admin. If used, assign your django users to groups that start with 'trac_'. So, users assigned to the 'trac_developer' group in django, would be assigned to the group 'developer' in trac. Note: All users must be 'active' in django regardless of this setting.
- login_url and logout_url should point to the login and logout urls of your django app. Unfortunately, they do not currently override the defaults as they should. I had intended to use django's 'next' feature to redirect back to trac after login but never got that far.
- configuration in apache, AuthType Basic, etc, is not needed.
(4.6 KB) -
added by waylan 7 years ago.
Initial version of the plugin. Rough around the edges, Perhaps someday I'll commit to svn.
(3.9 KB) -
added by waylan 6 years ago.
Code updated by Katie Lohrenz and emailed to me on January 10, 2008.
(4.2 KB) -
added by waylan 6 years ago.
Another iteration by Milan Andric which he emailed me on April 25, 2008.
Download all attachments as: .zip