Search code examples
drupalcontent-management-systemtrac

Make Trac use a Drupal user database for authentication


I am trying to set up a Trac instance as a complement to a Drupal site and would like to give users the possibility to use their Drupal account in Trac, too, ideally in a single sign-on fashion (if the user is already logged into Drupal, he is automatically logged into Trac).

The question now is how to accomplish this. I have found a plugin named DrupalIntegration which seems to implement that functionality; however, it is poorly documented - in fact, not documented at all. I managed to install it, but don't know how to configure it. Here is what I came up with from looking at the source code and the documentation of the AccountManager plugin (on which DrupalIntegration depends):

[components]
trac.web.auth.loginmodule = disabled
acct_mgr.api = enabled
acct_mgr.web_ui.LoginModule = enabled
acct_mgr.web_ui.RegistrationModule = disabled
TracDrupalIntegration.DrupalIntegration = enabled

[account-manager]
drupal_database = mysql://<usernam>:<password>@localhost/<db>
password_store = DrupalIntegration

(<username>, <password> and <db> are naturally substituted with the correct data). While the Trac log says:

2010-12-18 10:54:09,570 Trac[loader] DEBUG: Loading TracDrupalIntegration from /usr/lib/python2.5/site-packages/TracDrupalIntegration-0.1-py2.5.egg

this doesn't seem to work: trying to log in with a Drupal username / password results in an "Invalid username or password" error.

Has someone used the DrupalIntegration and can point out to me what I did wrong? Or is there any other approach you know (or even have used in the past) to integrate Drupal and Trac that way?


Solution

  • You could also consider using a third-party authentication system that both Drupal and Trac could talk to, such as LDAP or OpenID. OpenID appears to be especially promising, since it's built into Drupal core and there is a Trac plugin that appears to be actively developed.