PlaggerLDR 改造
簡易認証追加と server.pl -d
のときだけデバッグモードになるように
Index: lib/PlaggerLDR/Controller/API.pm
===================================================================
--- lib/PlaggerLDR/Controller/API.pm (revision 1819)
+++ lib/PlaggerLDR/Controller/API.pm (working copy)
@@ -12,8 +12,9 @@
my $module = first { $_->{module} eq 'Store::DBIC' } @{$config->{plugins}};
my $schema = Plagger::Schema::SQLite->connect(@{$module->{config}->{connect_info}});
-sub default : Private {
+sub auto : Private {
my($self, $c) = @_;
+ $c->user;
}
sub subs : Local {
Index: lib/PlaggerLDR.pm
===================================================================
--- lib/PlaggerLDR.pm (revision 1819)
+++ lib/PlaggerLDR.pm (working copy)
@@ -3,21 +3,45 @@
use strict;
use warnings;
-use Catalyst qw/-Debug/;
+use Catalyst qw(
+ Authentication
+ Authentication::Credential::Password
+ Authentication::Store::Minimal
+ Session
+ Session::State::Cookie
+ Session::Store::FastMmap
+);
+
__PACKAGE__->config(
name => 'PlaggerLDR',
'View::JSON' => {
expose_stash => 'json',
},
+ authentication => {
+ users => {
+ your_username => { password => 'your_password', },
+ },
+ },
);
__PACKAGE__->setup;
sub default : Private {
my ( $self, $c ) = @_;
- # Hello World
- $c->response->body( $c->welcome_message );
+ $c->login(
+ $c->req->params->{u},
+ $c->req->params->{p},
+ );
+
+ $c->res->status(404);
}
1;