2006-11-20 02:52:18 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# HTTP basic auth plugin.
|
|
|
|
package IkiWiki::Plugin::httpauth;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2007-04-27 04:55:52 +02:00
|
|
|
use IkiWiki 2.00;
|
2006-11-20 02:52:18 +01:00
|
|
|
|
|
|
|
sub import { #{{{
|
2008-08-03 22:40:12 +02:00
|
|
|
hook(type => "getsetup", id => "httpauth", call => \&getsetup);
|
2006-11-20 10:40:09 +01:00
|
|
|
hook(type => "auth", id => "httpauth", call => \&auth);
|
2006-11-20 02:52:18 +01:00
|
|
|
} # }}}
|
|
|
|
|
2008-08-03 22:40:12 +02:00
|
|
|
sub getsetup () { #{{{
|
|
|
|
return
|
|
|
|
plugin => {
|
|
|
|
safe => 1,
|
|
|
|
rebuild => 0,
|
|
|
|
},
|
|
|
|
} #}}}
|
|
|
|
|
2006-11-20 02:52:18 +01:00
|
|
|
sub auth ($$) { #{{{
|
|
|
|
my $cgi=shift;
|
|
|
|
my $session=shift;
|
|
|
|
|
|
|
|
if (defined $cgi->remote_user()) {
|
|
|
|
$session->param("name", $cgi->remote_user());
|
|
|
|
}
|
|
|
|
} #}}}
|
|
|
|
|
|
|
|
1
|