我在带有subversion的多项目设置中使用Trac 0.12.3,并使用主干中的AccountManagerPlugin。默认的索引页面登记了所有的项目目录,点击其中的任何一个都会进入该项目的trac页面。当我尝试登录时,我成功地通过了身份验证,然而,进入另一个项目需要我再次登录。我想使用单点登录,并按照中提到的步骤进行操作http://trac-hacks.org/wiki/CookBook/AccountManagerPluginConfiguration#SingleSignOn
它总是要求我登录每个项目。
我的apache配置:
<VirtualHost *:80>
ServerName trac.myproject.com
ServerAdmin your@email.com
DocumentRoot /trac
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
<Location /svn>
DAV svn
SVNParentPath /svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/svnauth
Require valid-user
AuthzSVNAccessFile /etc/svnaccess
</Location>
<LocationMatch "/.+">
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /trac/
PythonOption TracUriRoot /
#AuthType Basic
#AuthName "Trac"
#AuthUserFile /etc/svnauth
#Require valid-user
</LocationMatch>
</VirtualHost>
Trac.ini文件,从中继承所有其他项目特定的Trac.ini文件:
[trac]
trac_auth = /trac/cookie
trac_auth_session = /trac/session
#I have also tried setting it as trac_auth_cookie = /trac/cookie
[header_logo]
alt = Logo
height = -1
link = /
src = http://projects.hostgeyser.com/templates/frost/images/logo%20250%20x%2089_new.png
width = -1
[components]
acct_mgr.admin.* = enabled
acct_mgr.api.* = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.htfile.htdigeststore = disabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.http.httpauthstore = disabled
acct_mgr.notification.* = enabled
acct_mgr.pwhash.htdigesthashmethod = disabled
acct_mgr.pwhash.htpasswdhashmethod = disabled
acct_mgr.svnserve.* = enabled
acct_mgr.svnserve.svnservepasswordstore = disabled
acct_mgr.web_ui.* = enabled
trac.web.auth.loginmodule = disabled
acct_mgr.http.httpauthstore = enabled
[account-manager]
password_store = HtPasswdStore
htpasswd_hash_type = md5
htpasswd_file = /etc/svnauth
您不能像在这里那样混合身份验证:
AuthType Basic
的Apache配置- AccountManager登录模块(由
acct_mgr.web_ui.* = enabled
启用)
只选择其中一个。如果您想要AcctMgr中的SSO,请坚持使用auth_cookie_path = <all-env-common-basepath>
。根据启用的组件和安装的Trac插件,wiki页面TracIni具有Trac应用程序的所有有效配置密钥,具体取决于Trac环境。
双重技巧。我刚刚也犯了同样的错误。文档(以及hasienda的答案)谈到了"基本路径",这很容易让我们思考文件系统(以及PHP会话使用的会话文件)。这是第一个错误:这是trac父环境的URL路径所以如果你的trac项目使用类似http://www.example.org/trac/<project>
的东西,你的设置必须是auth_cookie_path = /trac
。
第二个陷阱:浏览器中剩余的旧cookie。尽管我最终如上所述调整了我的auth_cookie_path
,但我仍然无法进行身份验证。我的罐子里放着一个来自一个项目的旧trac_auth
饼干。在我取下那个之后,它开始像符咒一样工作!