Feature #2693

Use Redmine.pm to authenticate for any directory

Added by Felix Schäfer over 13 years ago. Updated over 11 years ago.

Status:NewStart date:2009-02-07
Priority:NormalDue date:
Assignee:-% Done:


Category:SCM extra
Target version:-


Redmine: r2363

I'd like to be able to use the Redmine user credentials to authenticate users for other directories than svn repositories in Apache. I've already tried hacking my way through the perl module (I don't know a bit of perl...) and came up with the following patch (from svn diff extra/svn/Redmine.pm):

Index: extra/svn/Redmine.pm
--- extra/svn/Redmine.pm        (revision 2383)
+++ extra/svn/Redmine.pm        (working copy)
@@ -142,6 +142,11 @@
     args_how => TAKE1,
     errmsg => 'RedmineCacheCredsMax must be decimal number',
+  {
+    name => 'RedmineProject',
+    req_override => OR_AUTHCFG,
+    args_how => TAKE1,
+  },

 sub RedmineDSN { 
@@ -166,6 +171,11 @@
   $self->{RedmineQuery} = trim($self->{RedmineQuery}.($arg ? $arg : "")." ");

+sub RedmineProject { set_val('RedmineProject', @_); }
 sub RedmineCacheCredsMax { 
   my ($self, $parms, $arg) = @_;
   if ($arg) {
@@ -327,9 +337,18 @@

 sub get_project_identifier {
     my $r = shift;
-    my $location = $r->location;
-    my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
+    my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
+    my $identifier;
+    my $project = $cfg->{RedmineProject} ? $cfg->{RedmineProject} : "";
+    if ($project) {
+      $identifier = $project;
+    } else {
+      my $location = $r->location;
+      ($identifier) = $r->uri =~ m{$location/*([^/]+)};
+    }

This seems to not brake the authentication for svn repositories, and get_project_identifier() returns the RedmineProject value defined in the apache config if set, but I sill can't log in in the directory I'm trying to use it for. Here the relevant <Location> part in the apache config:

        <Location /digischrank/test>
                AuthType basic
                AuthName "Digischrank Test" 
                Require valid-user
                PerlAccessHandler Apache::Authn::Redmine::access_handler
                PerlAuthenHandler Apache::Authn::Redmine::authen_handler
                RedmineDSN "DBI:mysql:database=SomedaTaBAse;host=localhost" 
                RedmineDbUser "SoMeuSer" 
                RedmineDbPass "SomePaSS" 
                RedmineProject "digischrank" 

As I said, my perl is nearly non-existant, so the above hackery might make your eyeballs hurt, and my understanding of the whole apache authentication thing isn't that good either, but I'd be happy for any help to solve this, and even if it's not considered a feature redmine should get shipped with, I'm sure other people would be happy to have something like this.


#1 Updated by Mathias Kühn over 13 years ago

Hey Alex,

i like that approach. I've also submitted a patch for a similar problem (#2647) and i believe we should throw all these things into a generic approach covering all different aspects of authentication.

#2 Updated by Toshi MARUYAMA over 11 years ago

  • Category set to SCM

#3 Updated by Toshi MARUYAMA over 11 years ago

  • Category changed from SCM to SCM extra

Also available in: Atom PDF