Project

General

Profile

Patch #6414 ยป Redmine.pm_AllowAlternateAuth.diff

Patch against redmine-1.0.1 - Sergio Talens-Oliag, 2010-09-16 13:23

View differences:

redmine-1.0.1/extra/svn/Redmine.pm 2010-09-16 11:54:10.000000000 +0200
64 64
     # RedmineCacheCredsMax 50
65 65
  </Location>
66 66

  
67
If you want to be able to use additional authentication methods (i.e.
68
to have read-only users that are not on LDAP or on the Redmine
69
database) you can do it setting RedmineAllowAlternateAuth to on (with
70
this setting the module returns DECLINE and apache moves to the next
71
authentication module). As an example, if you want to use the Redmine
72
users and the /etc/apache2/htpasswd file to validate the subversion
73
users you can use a configuration like the following:
74

  
75
   PerlLoadModule Apache::Authn::Redmine
76
   <Location /svn>
77
     DAV svn
78
     SVNParentPath "/var/svn"
79

  
80
     AuthType Basic
81
     AuthName redmine
82
     Require valid-user
83

  
84
     PerlAccessHandler Apache::Authn::Redmine::access_handler
85
     PerlAuthenHandler Apache::Authn::Redmine::authen_handler
86

  
87
     RedmineAllowAlternateAuth on
88

  
89
     RedmineDSN "DBI:Pg:database=databasename;host=my.db.server"
90

  
91
     RedmineDbUser "redmine"
92
     RedmineDbPass "password"
93

  
94
     AuthBasicProvider file
95
     AuthUserFile      "/etc/apache2/htpasswd"
96
  </Location>
97

  
67 98
To be able to browse repository inside redmine, you must add something
68 99
like that :
69 100

  
......
142 173
    args_how => TAKE1,
143 174
    errmsg => 'RedmineCacheCredsMax must be decimal number',
144 175
  },
176
  {
177
    name => 'RedmineAllowAlternateAuth',
178
    req_override => OR_AUTHCFG,
179
    args_how => FLAG,
180
  },
145 181
);
146 182

  
147 183
sub RedmineDSN { 
......
177 213
    $self->{RedmineCacheCredsMax} = $arg;
178 214
  }
179 215
}
216
sub RedmineAllowAlternateAuth { set_val('RedmineAllowAlternateAuth', @_); }
180 217

  
181 218
sub trim {
182 219
  my $string = shift;
......
223 260
      return OK;
224 261
  } else {
225 262
      $r->note_auth_failure();
263
      my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
264
      if ( $cfg->{RedmineAllowAlternateAuth} ) {
265
            return DECLINED;
266
      }
226 267
      return AUTH_REQUIRED;
227 268
  }
228 269
}
    (1-1/1)