From: Jess Robinson Date: Fri, 4 May 2012 10:17:27 +0000 (+0000) Subject: Basic usable login-auth using KiokuDB X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16562d80c93bb2dac55f7dd45021217d3b7bb6f6;p=scpubgit%2Fstemmaweb.git Basic usable login-auth using KiokuDB --- diff --git a/Makefile.PL b/Makefile.PL index a31e6ed..e42015a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -18,6 +18,13 @@ requires 'Catalyst::Model::KiokuDB'; requires 'Catalyst::View::Download::Plain'; requires 'Catalyst::View::JSON'; requires 'Catalyst::View::TT'; +## Auth: +requires 'Catalyst::Plugin::Authentication'; +requires 'Catalyst::Plugin::Session'; +requires 'Catalyst::Plugin::Session::Store::File'; +requires 'Catalyst::Plugin::Session::State::Cookie'; +requires 'CatalystX::SimpleLogin'; +## requires 'Moose'; requires 'TryCatch'; requires 'namespace::autoclean'; diff --git a/lib/stemmaweb.pm b/lib/stemmaweb.pm index 94121c1..b2f68e8 100644 --- a/lib/stemmaweb.pm +++ b/lib/stemmaweb.pm @@ -4,6 +4,10 @@ use namespace::autoclean; use Catalyst::Runtime 5.80; +use Search::GIN::Extract::Class; +use Search::GIN::Extract::Attributes; +use Search::GIN::Extract::Multiplex; + # Set flags and add plugins for the application. # # Note that ORDERING IS IMPORTANT here as plugins are initialized in order, @@ -20,6 +24,11 @@ use Catalyst qw/ ConfigLoader Static::Simple Unicode::Encoding + +CatalystX::SimpleLogin + Authentication + Session + Session::Store::File + Session::State::Cookie /; extends 'Catalyst'; @@ -48,6 +57,20 @@ __PACKAGE__->config( stemmaweb->path_to( 'root', 'src' ), ], }, + ## kiokudb auth store testing + 'Plugin::Authentication' => { + default => { + credential => { + class => 'Password', + password_field => 'password', + password_type => 'self_check', + }, + store => { + class => 'Model::KiokuDB', + model_name => 'User', + }, + } + }, ); # Start the application diff --git a/lib/stemmaweb/Model/User.pm b/lib/stemmaweb/Model/User.pm new file mode 100644 index 0000000..d8f8c91 --- /dev/null +++ b/lib/stemmaweb/Model/User.pm @@ -0,0 +1,11 @@ +package stemmaweb::Model::User; +use strict; +use warnings; +use Moose; +use Text::Tradition::UserStore; + +extends 'Catalyst::Model::KiokuDB'; + +has '+model_class' => ( default => 'Text::Tradition::UserStore' ); + +1; diff --git a/stemmaweb.conf b/stemmaweb.conf index a64ce1e..a0169dc 100644 --- a/stemmaweb.conf +++ b/stemmaweb.conf @@ -3,4 +3,7 @@ name = stemmaweb dsn dbi:SQLite:dbname=db/traditions.db - \ No newline at end of file + + + dsn dbi:SQLite:dbname=db/traditions.db +