Commit | Line | Data |
---|---|---|
7dc32473 MG |
1 | #!/usr/bin/perl -w |
2 | use v5.14; | |
3 | ||
c85bf4a6 | 4 | use Apache2::Authen::Passphrase qw/pwcheck/; |
7dc32473 | 5 | use Plack::App::Gruntmaster; |
c85bf4a6 MG |
6 | use Plack::Builder; |
7 | use Plack::Request; | |
8 | ||
9 | sub some_auth_required { | |
10 | my $r = Plack::Request->new($_[0]); | |
8d29b3b1 MG |
11 | my $word = qr,(\w+),a; |
12 | return 1 if $r->path eq '/action/passwd' || $r->path =~ m,/pb/$word/submit$,; | |
c85bf4a6 MG |
13 | 0 |
14 | } | |
7dc32473 MG |
15 | |
16 | builder { | |
287424cb | 17 | enable 'ContentLength'; |
c85bf4a6 | 18 | enable 'Static', path => qr,/static/,; |
7dc32473 | 19 | enable 'Log4perl', category => 'plack', conf => 'log.conf'; |
c85bf4a6 | 20 | enable_if \&some_auth_required, 'Auth::Basic', authenticator => sub { eval {pwcheck @_; 1} }, realm => 'Gruntmaster 6000'; |
7dc32473 MG |
21 | Plack::App::Gruntmaster->to_app |
22 | } |