path: root/gitweb/INSTALL
diff options
authorAlexander Gavrilov <>2008-11-05 22:36:23 (GMT)
committerJunio C Hamano <>2008-11-07 00:38:51 (GMT)
commitdd7f5f105a1d4d094a96c5e3f251854f81106be0 (patch)
tree0fc0de6cf471f6af9e390535d9e978ee6376f2df /gitweb/INSTALL
parentec26f098a6593bbd9d396fb7ee74368cdd3eeed3 (diff)
gitweb: Add a per-repository authorization hook.
Add a configuration variable that can be used to specify an arbitrary subroutine that will be called in the same situations where $export_ok is checked, and its return value used to decide whether the repository is to be shown. This allows the user to implement custom authentication schemes, for example by issuing a subrequest through mod_perl and checking if Apache will authorize it. Signed-off-by: Alexander Gavrilov <> Acked-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'gitweb/INSTALL')
1 files changed, 21 insertions, 0 deletions
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index 26967e2..18c9ce3 100644
--- a/gitweb/INSTALL
+++ b/gitweb/INSTALL
@@ -166,6 +166,27 @@ Gitweb repositories
shows repositories only if this file exists in its object database
(if directory has the magic file named $export_ok).
+- Finally, it is possible to specify an arbitrary perl subroutine that
+ will be called for each project to determine if it can be exported.
+ The subroutine receives an absolute path to the project as its only
+ parameter.
+ For example, if you use mod_perl to run the script, and have dumb
+ http protocol authentication configured for your repositories, you
+ can use the following hook to allow access only if the user is
+ authorized to read the files:
+ $export_auth_hook = sub {
+ use Apache2::SubRequest ();
+ use Apache2::Const -compile => qw(HTTP_OK);
+ my $path = "$_[0]/HEAD";
+ my $r = Apache2::RequestUtil->request;
+ my $sub = $r->lookup_file($path);
+ return $sub->filename eq $path
+ && $sub->status == Apache2::Const::HTTP_OK;
+ };
Generating projects list using gitweb