svn mysql认证,使用SVN认证的MySQL

I'm trying to setup per repository SVN authentication via MySQL but I'm having a few problems.

Firstly what is the difference between mod_authn_dbd and mod_auth_mysql?

Secondly I already have a MySQL database setup with a table for users, groups and permissions. Is it possible using either of these mods to link into my current permission system where by a username, password and permission is required to access the repository (Preferable with a read permission and write permission per repository)

tbl_users: user_id, user_name, user_hash

tbl_group: group_id, group_name

tbl_permission: permission_id, permission_name

tbl_user_group: user_id, group_id

tbl_group_permission: group_id, permission_id

tbl_user_permission: user_id, permission_id

解决方案

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:

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

Now add your desired authentication configuration into the apache configuration:

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

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值