From: Marius Gavrilescu Date: Wed, 5 Feb 2014 10:02:02 +0000 (+0200) Subject: Add authentication X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c85bf4a6f59d43c42ffc90ad0389edeba99a36fb;p=gruntmaster-page.git Add authentication --- 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 }