SVN Authentication using MySQL

♀尐吖头ヾ 提交于 2019-12-06 06:02:15
Bjoern

Firstly the difference.

mod_authn_dbd provides authentication front-ends such as mod_auth_digest and mod_auth_basic to authenticate users by looking up users in SQL tables.

mod_auth_mysql is an Apache module that allows authentication using user and group data stored in MySQL databases. The project seems to not have updated since 2005, so I'd go for mod_authn_dbd.

To set this up properly, first you need to configure mod_authn_dbd and mod_dbd up properly in your apache configuration, mod_dbd takes care of your database connection. Once you've done this (make sure your Apache is running with those modules active), then you can go ahead configuring them.

Add something like this to your apache configuration to configure the database connection:

<IfModule mod_dbd.c>
  DBDriver mysql
  DBDParams "host=(your_db_server, p.e. 127.0.0.1) dbname=your_db_name user=your_db_user pass=your_db_pass"
  DBDMin 1
  DBDKeep 8
  DBDMax 20
  DBDExptime 200
</IfModule> 

Now add your desired authentication configuration into the apache configuration:

<Directory "/your/svn/repository/path/">
  Options FollowSymLinks Indexes MultiViews
  AuthType Basic
  AuthName "Allowed users Only"
  AuthBasicProvider dbd
  AuthDBDUserPWQuery "SELECT pwd FROM tbl_users, tbl_user_group WHERE tbl_users.user_id=%s AND tbl_user.user_id=tbl_user_group.user_id"
  Require valid-user
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

I've simplified the SELECT-statement for better readability, you have to expand this to get your configuration refined.

EDIT:

After typing I've found a very good example in the web, maybe read it here, too. It goes alot deeper than my simplified answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!