##// END OF EJS Templates
Redmine.pm for webdav authentication:...
Jean-Philippe Lang -
r1321:2bcb7820875b
parent child
Show More
@@ -8,8 +8,8 against redmine database
8 8 =head1 SYNOPSIS
9 9
10 10 This module allow anonymous users to browse public project and
11 registred users to browse and commit their project. authentication is
12 done on the redmine database.
11 registred users to browse and commit their project. Authentication is
12 done against the redmine database or the LDAP configured in redmine.
13 13
14 14 This method is far simpler than the one with pam_* and works with all
15 15 database without an hassle but you need to have apache/mod_perl on the
@@ -29,6 +29,9 On debian/ubuntu you must do :
29 29
30 30 aptitude install libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl
31 31
32 If your Redmine users use LDAP authentication, you will also need
33 Authen::Simple::LDAP (and IO::Socket::SSL if LDAPS is used).
34
32 35 =head1 CONFIGURATION
33 36
34 37 ## if the module isn't in your perl path
@@ -90,7 +93,8 use strict;
90 93
91 94 use DBI;
92 95 use Digest::SHA1;
93 use Authen::Simple::LDAP;
96 # optional module for LDAP authentication
97 my $CanUseLDAPAuth = eval("use Authen::Simple::LDAP; 1");
94 98
95 99 use Apache2::Module;
96 100 use Apache2::Access;
@@ -188,21 +192,21 sub is_member {
188 192 $ret = 1;
189 193 last;
190 194 }
191 } else {
195 } elsif ($CanUseLDAPAuth) {
192 196 my $sthldap = $dbh->prepare(
193 "SELECT host,port,account,account_password,base_dn,attr_login from auth_sources WHERE id = ?;"
197 "SELECT host,port,tls,account,account_password,base_dn,attr_login from auth_sources WHERE id = ?;"
194 198 );
195 199 $sthldap->execute($row[1]);
196 200 while (my @rowldap = $sthldap->fetchrow_array) {
197 201 my $ldap = Authen::Simple::LDAP->new(
198 host => $rowldap[0],
199 port => $rowldap[1],
200 basedn => $rowldap[4],
201 binddn => $rowldap[2] ? $rowldap[2] : "",
202 bindpw => $rowldap[3] ? $rowldap[3] : "",
203 filter => "(".$rowldap[5]."=%s)"
204 );
205 $ret = 1 if ($ldap->authenticate($redmine_user, $redmine_pass));
202 host => ($rowldap[2] == 1 || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]" : $rowldap[0],
203 port => $rowldap[1],
204 basedn => $rowldap[5],
205 binddn => $rowldap[3] ? $rowldap[3] : "",
206 bindpw => $rowldap[4] ? $rowldap[4] : "",
207 filter => "(".$rowldap[6]."=%s)"
208 );
209 $ret = 1 if ($ldap->authenticate($redmine_user, $redmine_pass));
206 210 }
207 211 $sthldap->finish();
208 212 }
General Comments 0
You need to be logged in to leave comments. Login now