From c85bf4a6f59d43c42ffc90ad0389edeba99a36fb Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 5 Feb 2014 12:02:02 +0200 Subject: [PATCH] Add authentication --- app.psgi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app.psgi b/app.psgi index 02d6e88..17707ca 100644 --- 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 } -- 2.39.2