summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/httpauth.pm
blob: fc0cffb1e3fa3d529baccc812b0ee77818bd6a39 (plain)
  1. #!/usr/bin/perl
  2. # HTTP basic auth plugin.
  3. package IkiWiki::Plugin::httpauth;
  4. use warnings;
  5. use strict;
  6. use IkiWiki 2.00;
  7. sub import { #{{{
  8. hook(type => "getsetup", id => "httpauth", call => \&getsetup);
  9. hook(type => "auth", id => "httpauth", call => \&auth);
  10. } # }}}
  11. sub getsetup () { #{{{
  12. return
  13. plugin => {
  14. safe => 1,
  15. rebuild => 0,
  16. },
  17. } #}}}
  18. sub auth ($$) { #{{{
  19. my $cgi=shift;
  20. my $session=shift;
  21. if (defined $cgi->remote_user()) {
  22. $session->param("name", $cgi->remote_user());
  23. }
  24. } #}}}
  25. 1