github.com/hoffmann Peter Hoffmann on Stackoverflow @peterhoffmann on twitter Peter Hoffmann on Facebook Contact me per email Subscribe to Atom Feed

Peter Hoffmann

Software Engineer
prev page next page

Authenticate Trac against a MySQL Table

Posted on May 28, 2011

Recently I had to set up a trac instance which had to reuse authentification from an existing application.

Using Apache2 with Auth_MySQL it's really easy:

    ScriptAlias /trac /var/www-trac/deploy/cgi-bin/trac.fcgi/
    <Location "/trac">
            AuthName "Please Authenticate"
            AuthType Basic
            require valid-user
            AuthUserFile /dev/null
            AuthBasicAuthoritative Off

            Auth_MySQL On
            Auth_MySQL_Host localhost
            Auth_MySQL_User dbuser 
            Auth_MySQL_Password dbpw
            Auth_MySQL_DB dbname
            Auth_MySQL_Password_Table Users
            Auth_MySQL_Username_Field username
            Auth_MySQL_Password_Field passwd
            Auth_MySQL_Encryption_Types Plaintext
            Auth_MySQL_Authoritative Off
    </Location>