Add autocreate user and add openid login back
[scpubgit/stemmaweb.git] / lib / stemmaweb.pm
CommitLineData
b8a92065 1package stemmaweb;
2use Moose;
3use namespace::autoclean;
4
5use Catalyst::Runtime 5.80;
6
16562d80 7use Search::GIN::Extract::Class;
8use Search::GIN::Extract::Attributes;
9use Search::GIN::Extract::Multiplex;
10
b8a92065 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
23use Catalyst qw/
b8a92065 24 ConfigLoader
25 Static::Simple
16562d80 26 Authentication
27 Session
28 Session::Store::File
29 Session::State::Cookie
19262e3d 30 StatusMessage
12566320 31 StackTrace
b8a92065 32/;
33
34extends 'Catalyst';
35
83ed6665 36use stemmaweb::Authentication::FormHandler;
37
b8a92065 38our $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,
532cc23b 53 # Set Unicode as the default
54 encoding => 'UTF-8',
b8a92065 55 default_view => 'TT',
56 'View::JSON' => {
57 expose_stash => 'result',
58 },
43ad4ba4 59 'View::TT' => {
60 INCLUDE_PATH => [
61 stemmaweb->path_to( 'root', 'src' ),
62 ],
63 },
16562d80 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',
5a9859b7 74 model_name => 'Directory',
16562d80 75 },
19262e3d 76 },
77 openid => {
78 credential => {
79 class => 'OpenID',
51cece70 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',
bafbd9ae 86 'type.email' => 'http://axschema.org/contact/email',
87 # type => {
88 # email => 'http://axschema.org/contact/email'
89 # }
51cece70 90 }
91 ],
19262e3d 92 },
93 store => {
94 class => 'Model::KiokuDB',
1412c8fc 95 model_name => 'Directory',
19262e3d 96 },
97 auto_create_user => 1,
98 },
85990daf 99 google => {
100 credential => {
101 class => '+stemmaweb::Authentication::Credential::Google',
102 },
103 store => {
104 class => 'Model::KiokuDB',
105 model_name => 'Directory',
c2ab3497 106 },
107 auto_create_user => 1,
85990daf 108 },
19262e3d 109 },
110 ## Auth with CatalystX::Controller::Auth
111 'Controller::Users' => {
83ed6665 112 form_handler => 'stemmaweb::Authentication::FormHandler',
19262e3d 113 model => 'User',
114 login_id_field => 'username',
115 login_db_field => 'username',
eb38afbc 116 action_after_login => '/users/success',
117 action_after_register => '/users/success',
bec03a85 118 enable_sending_register_email => 0,
eb38afbc 119 register_email_from => '"Stemmaweb" <stemmaweb@byzantini.st>',
b13cb1e8 120 register_email_subject => 'Registration to stemmaweb',
121 register_email_template_plain => 'register-plain.tt',
b600c671 122 realm => 'default',
75daf982 123 login_fields => { openid => [qw/openid_identifier/],
b600c671 124 default => [qw/username password remember/],
b1d9ab02 125 google => [qw/email id_token/],
19262e3d 126 },
16562d80 127 },
b13cb1e8 128 'View::Email::Template' => {
129 stash_key => 'email_template',
130 },
b74843e5 131
132 recaptcha => {
eb38afbc 133 pub_key => '6LfR19MSAAAAACy2meHvLfZGRn3PM2rRYIAfh665',
134 priv_key => '6LfR19MSAAAAAMlQb8BdyecWNRE1bAL2YSgz2sah',
b74843e5 135 },
b8a92065 136);
137
138# Start the application
139__PACKAGE__->setup();
140
141
142=head1 NAME
143
144stemmaweb - 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
156L<stemmaweb::Controller::Root>, L<Catalyst>
157
158=head1 AUTHOR
159
160Tara L Andrews
161
162=head1 LICENSE
163
164This library is free software. You can redistribute it and/or modify
165it under the same terms as Perl itself.
166
167=cut
168
1691;