b20063591153cfd53c544bc8c1f4fb26b94fab4a
[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     Authentication
27     Session
28     Session::Store::File
29     Session::State::Cookie
30     StatusMessage
31     StackTrace
32 /;
33
34 extends 'Catalyst';
35
36 use stemmaweb::Authentication::FormHandler;
37
38 our $VERSION = '0.01';
39
40 # Configure the application.
41 #
42 # Note that settings in stemmaweb.conf (or other external
43 # configuration file that you set up manually) take precedence
44 # over this when using ConfigLoader. Thus configuration
45 # details given here can function as a default configuration,
46 # with an external configuration file acting as an override for
47 # local deployment.
48
49 __PACKAGE__->config(
50     name => 'stemmaweb',
51     # Disable deprecated behavior needed by old applications
52     disable_component_resolution_regex_fallback => 1,
53     # Set Unicode as the default
54     encoding => 'UTF-8',
55     default_view => 'TT',
56         'View::JSON' => {
57                 expose_stash => 'result',
58         },
59         'View::TT' => {
60                 INCLUDE_PATH => [
61                         stemmaweb->path_to( 'root', 'src' ),
62                 ],
63         },
64     ## kiokudb auth store testing
65     'Plugin::Authentication' => {
66         default => {
67             credential => {
68                 class => 'Password',
69                 password_field => 'password',
70                 password_type => 'self_check',
71             },
72             store => {
73                 class => 'Model::KiokuDB',
74                 model_name => 'Directory',
75             },
76         },
77         openid => {
78             credential => {
79                 class => 'OpenID',
80                 extensions => ['http://openid.net/srv/ax/1.0' => 
81                     {
82                         ns          => 'ax',
83                         uri         => 'http://openid.net/srv/ax/1.0',
84                         mode        => 'fetch_request',
85                         required    => 'email',
86                         'type.email' => 'http://axschema.org/contact/email',
87                         # type        => {
88                         #     email => 'http://axschema.org/contact/email'
89                         # }
90                     }
91                     ],
92             },
93             store => {
94                 class => 'Model::KiokuDB',
95                 model_name => 'Directory',
96             },
97             auto_create_user => 1,
98         },
99         google => {
100             credential => {
101                 class => '+stemmaweb::Authentication::Credential::Google',
102             },
103             store => {
104                 class => 'Model::KiokuDB',
105                 model_name => 'Directory',
106             }
107         },
108     },
109     ## Auth with CatalystX::Controller::Auth
110     'Controller::Users' => {
111         form_handler => 'stemmaweb::Authentication::FormHandler',
112         model => 'User',
113         login_id_field => 'username',
114         login_db_field => 'username',
115         action_after_login => '/users/success',
116         action_after_register => '/users/success', 
117         enable_sending_register_email => 0,
118         register_email_from  => '"Stemmaweb" <stemmaweb@byzantini.st>',
119         register_email_subject => 'Registration to stemmaweb',
120         register_email_template_plain => 'register-plain.tt',
121         realm => 'default',
122         login_fields => { openid => [qw/openid_identifier/],
123                           default => [qw/username password remember/],
124                           google => [qw/email id_token/],
125         },
126     },
127     'View::Email::Template' => {
128         stash_key => 'email_template',
129     },
130
131     recaptcha => {
132         pub_key => '6LfR19MSAAAAACy2meHvLfZGRn3PM2rRYIAfh665',
133         priv_key => '6LfR19MSAAAAAMlQb8BdyecWNRE1bAL2YSgz2sah',
134     },
135 );
136
137 # Start the application
138 __PACKAGE__->setup();
139
140
141 =head1 NAME
142
143 stemmaweb - Catalyst based application
144
145 =head1 SYNOPSIS
146
147     script/stemmaweb_server.pl
148
149 =head1 DESCRIPTION
150
151 [enter your description here]
152
153 =head1 SEE ALSO
154
155 L<stemmaweb::Controller::Root>, L<Catalyst>
156
157 =head1 AUTHOR
158
159 Tara L Andrews
160
161 =head1 LICENSE
162
163 This library is free software. You can redistribute it and/or modify
164 it under the same terms as Perl itself.
165
166 =cut
167
168 1;