Replacing SimpleLogin with Controller::Auth (requires patch to ::Auth)
[scpubgit/stemmaweb.git] / lib / stemmaweb.pm
1 package stemmaweb;
2 use Moose;
3 use namespace::autoclean;
4
5 use Catalyst::Runtime 5.80;
6
7 use Search::GIN::Extract::Class;
8 use Search::GIN::Extract::Attributes;
9 use Search::GIN::Extract::Multiplex;
10
11 # Set flags and add plugins for the application.
12 #
13 # Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
14 # therefore you almost certainly want to keep ConfigLoader at the head of the
15 # list if you're using it.
16 #
17 #         -Debug: activates the debug mode for very useful log messages
18 #   ConfigLoader: will load the configuration from a Config::General file in the
19 #                 application's home directory
20 # Static::Simple: will serve static files from the application's root
21 #                 directory
22
23 use Catalyst qw/
24     ConfigLoader
25     Static::Simple
26     Unicode::Encoding
27     Authentication
28     Session
29     Session::Store::File
30     Session::State::Cookie
31     StatusMessage
32 /;
33
34 extends 'Catalyst';
35
36 our $VERSION = '0.01';
37
38 # Configure the application.
39 #
40 # Note that settings in stemmaweb.conf (or other external
41 # configuration file that you set up manually) take precedence
42 # over this when using ConfigLoader. Thus configuration
43 # details given here can function as a default configuration,
44 # with an external configuration file acting as an override for
45 # local deployment.
46
47 __PACKAGE__->config(
48     name => 'stemmaweb',
49     # Disable deprecated behavior needed by old applications
50     disable_component_resolution_regex_fallback => 1,
51     default_view => 'TT',
52         'View::JSON' => {
53                 expose_stash => 'result',
54         },
55         'View::TT' => {
56                 INCLUDE_PATH => [
57                         stemmaweb->path_to( 'root', 'src' ),
58                 ],
59         },
60     ## kiokudb auth store testing
61     'Plugin::Authentication' => {
62         default => {
63             credential => {
64                 class => 'Password',
65                 password_field => 'password',
66                 password_type => 'self_check',
67             },
68             store => {
69                 class => 'Model::KiokuDB',
70                 model_name => 'User',
71             },
72         },
73         openid => {
74             credential => {
75                 class => 'OpenID',
76             },
77             store => {
78                 class => 'Model::KiokuDB',
79                 model_name => 'User',
80             },
81             auto_create_user => 1,
82         },
83     },
84     ## Auth with CatalystX::Controller::Auth
85     'Controller::Users' => {
86         model => 'User',
87         login_id_field => 'username',
88         login_db_field => 'username',
89         action_after_login => '/index',
90         send_register_email => 0,
91         realm => 'openid',
92         login_fields => { openid => [], # qw/openid_identifier/],
93                           default => [qw/username password/],
94         },
95     },
96 );
97
98 # Start the application
99 __PACKAGE__->setup();
100
101
102 =head1 NAME
103
104 stemmaweb - Catalyst based application
105
106 =head1 SYNOPSIS
107
108     script/stemmaweb_server.pl
109
110 =head1 DESCRIPTION
111
112 [enter your description here]
113
114 =head1 SEE ALSO
115
116 L<stemmaweb::Controller::Root>, L<Catalyst>
117
118 =head1 AUTHOR
119
120 Tara L Andrews
121
122 =head1 LICENSE
123
124 This library is free software. You can redistribute it and/or modify
125 it under the same terms as Perl itself.
126
127 =cut
128
129 1;