]> iEval git - plack-app-gruntmaster.git/commitdiff
Add authentication
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 5 Feb 2014 10:02:02 +0000 (12:02 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 5 Feb 2014 10:02:02 +0000 (12:02 +0200)
app.psgi

index 02d6e88f2218e0be2cb1b1442787b8001c63de04..17707caf8cbaad7bc7efa1af377446a8cdcbbe7c 100644 (file)
--- a/app.psgi
+++ b/app.psgi
@@ -1,11 +1,19 @@
 #!/usr/bin/perl -w
 use v5.14;
 
-use Plack::Builder;
+use Apache2::Authen::Passphrase qw/pwcheck/;
 use Plack::App::Gruntmaster;
+use Plack::Builder;
+use Plack::Request;
+
+sub some_auth_required {
+       my $r = Plack::Request->new($_[0]);
+       0
+}
 
 builder {
-       enable 'Static', path => qr,/static/,, pass_through => 1;
+       enable 'Static', path => qr,/static/,;
        enable 'Log4perl', category => 'plack', conf => 'log.conf';
+       enable_if \&some_auth_required, 'Auth::Basic', authenticator => sub { eval {pwcheck @_; 1} }, realm => 'Gruntmaster 6000';
        Plack::App::Gruntmaster->to_app
 }
This page took 0.029899 seconds and 4 git commands to generate.