summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/httpauth.pm
blob: 1816c9d74c27aaee1e2b6114e62dd06b8fca1d4c (plain)
  1. #!/usr/bin/perl
  2. # HTTP basic auth plugin.
  3. package IkiWiki::Plugin::httpauth;
  4. use warnings;
  5. use strict;
  6. use IkiWiki 3.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