Project

General

Profile

Redmine Perl Module working with Apache MPM Worker

Added by Anonymous over 13 years ago

Hi all,

I experienced some issues to get Redmine Perl Module working with Apache MPM Worker.

Software Versions:
  • Linux Ubuntu Lucid
  • Apache 2.2 + MPM Worker
  • Subversion 1.6.6

The issue occured when Apache makes internal redirection requests which is the case when you get acces to Subversion through WebDAV.

To fix this issue, you need to detect if the request is initial in order to process Authentication and Authorization logic only when initial request is made.

Subsequent requests made by Apache are ignored because subsequent requests exists only if the initial request returned OK.

Below, the code to detect if the request is initial :

sub authz_handler {

    my $r = shift;

    unless ( $r->some_auth_required ) {
        $r->log_reason( "No authentication handler has been configured", 
            $r->uri );
        return FORBIDDEN;
    }

    unless ($r->is_initial_req) {
        return OK;
    }

    [...]
}

sub authen_handler {

    my $r = shift;

    unless ($r->is_initial_req) {
        return OK;
    }

    # Here the dialog pops up and asks you for userid and password
    my($res, $passwd_sent) = $r->get_basic_auth_pw;
    if ($res) {
        return $res; # e.g. HTTP_UNAUTHORIZED
    }

    my $user_sent = $r->user;

    [...]  
}

I hope it will be usefull for someone else,

Regards,
Alexandre


Replies (1)

RE: Redmine Perl Module working with Apache MPM Worker - Added by Felix Schäfer over 13 years ago

We use SVNPathAuthz off to "only" authenticate/authorize against the root of the repo, as redmine doesn't provide finer-grained ones, but thanks for the tip, might be of interest for the my git integration fort/patch :-)

    (1-1/1)