Project

General

Profile

Actions

Feature #2693

open

Use Redmine.pm to authenticate for any directory

Added by Felix Schäfer over 14 years ago. Updated about 12 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
SCM extra
Target version:
-
Start date:
2009-02-07
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

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/*([^/]+)};
+    }
     $identifier;
 }

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" 
        </Location>

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.

Actions #1

Updated by Mathias Kühn over 14 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.

Actions #2

Updated by Toshi MARUYAMA about 12 years ago

  • Category set to SCM
Actions #3

Updated by Toshi MARUYAMA about 12 years ago

  • Category changed from SCM to SCM extra
Actions

Also available in: Atom PDF