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