1

我在带有 subversion 的多项目设置中使用 Trac 0.12.3,并且正在使用来自主干的 AccountManagerPlugin。默认索引页面列出了所有项目目录,单击其中任何一个都会将我带到该项目的 trac 页面。当我尝试登录时,我已成功通过身份验证,但是,进入另一个项目需要我再次登录。我想使用单点登录并遵循http://trac-hacks.org/wiki/CookBook/AccountManagerPluginConfiguration#SingleSignOn中提到的步骤

它总是要求我为每个项目登录。

我的阿帕奇配置:

<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
4

2 回答 2

0

您不能像在此处那样混合身份验证:

  • Apache 配置由AuthType Basic
  • AccountManager LoginModule(由 启用acct_mgr.web_ui.* = enabled

只决定其中一项。如果您想要来自 AcctMgr 的 SSO,请坚持使用auth_cookie_path = <all-env-common-basepath>. wiki 页面TracIni具有 Trac 应用程序的所有有效配置键,Trac 环境特定的,取决于启用的组件和安装的 Trac 插件。

于 2012-02-29T22:56:09.787 回答
0

双重棘手。我只是利用了同样的失误。文档(以及hasienda 的答案)谈到了“基本路径”,这让我们很容易想到文件系统(以及类似于 PHP 会话使用的会话文件)。这是第一个错误:它是trac父环境的URL 路径。因此,如果您的 trac 项目使用类似的东西,您的设置必须是.http://www.example.org/trac/<project>auth_cookie_path = /trac

第二个陷阱:浏览器中残留的旧 cookie。虽然我最终auth_cookie_path如上所述调整了我的,但我仍然无法进行身份验证。trac_auth我的罐子里放着一个项目的旧饼干。在我删除那个之后,它开始像魅力一样工作!

于 2013-10-08T22:35:14.817 回答