Add autocreate user and add openid login back
[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             auto_create_user => 1,
108         },
109     },
110     ## Auth with CatalystX::Controller::Auth
111     'Controller::Users' => {
112         form_handler => 'stemmaweb::Authentication::FormHandler',
113         model => 'User',
114         login_id_field => 'username',
115         login_db_field => 'username',
116         action_after_login => '/users/success',
117         action_after_register => '/users/success', 
118         enable_sending_register_email => 0,
119         register_email_from  => '"Stemmaweb" <stemmaweb@byzantini.st>',
120         register_email_subject => 'Registration to stemmaweb',
121         register_email_template_plain => 'register-plain.tt',
122         realm => 'default',
123         login_fields => { openid => [qw/openid_identifier/],
124                           default => [qw/username password remember/],
125                           google => [qw/email id_token/],
126         },
127     },
128     'View::Email::Template' => {
129         stash_key => 'email_template',
130     },
131
132     recaptcha => {
133         pub_key => '6LfR19MSAAAAACy2meHvLfZGRn3PM2rRYIAfh665',
134         priv_key => '6LfR19MSAAAAAMlQb8BdyecWNRE1bAL2YSgz2sah',
135     },
136 );
137
138 # Start the application
139 __PACKAGE__->setup();
140
141
142 =head1 NAME
143
144 stemmaweb - Catalyst based application
145
146 =head1 SYNOPSIS
147
148     script/stemmaweb_server.pl
149
150 =head1 DESCRIPTION
151
152 [enter your description here]
153
154 =head1 SEE ALSO
155
156 L<stemmaweb::Controller::Root>, L<Catalyst>
157
158 =head1 AUTHOR
159
160 Tara L Andrews
161
162 =head1 LICENSE
163
164 This library is free software. You can redistribute it and/or modify
165 it under the same terms as Perl itself.
166
167 =cut
168
169 1;