]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/httpauth.pm
po(otherlanguagesloop): start factorizing
[git.ikiwiki.info.git] / IkiWiki / Plugin / httpauth.pm
1 #!/usr/bin/perl
2 # HTTP basic auth plugin.
3 package IkiWiki::Plugin::httpauth;
5 use warnings;
6 use strict;
7 use IkiWiki 2.00;
9 sub import { #{{{
10         hook(type => "getsetup", id => "httpauth", call => \&getsetup);
11         hook(type => "auth", id => "httpauth", call => \&auth);
12 } # }}}
14 sub getsetup () { #{{{
15         return
16                 plugin => {
17                         safe => 1,
18                         rebuild => 0,
19                 },
20 } #}}}
22 sub auth ($$) { #{{{
23         my $cgi=shift;
24         my $session=shift;
26         if (defined $cgi->remote_user()) {
27                 $session->param("name", $cgi->remote_user());
28         }
29 } #}}}
31 1