source: server/trunk/web/lib/Sophie.pm @ 124

Last change on this file since 124 was 124, checked in by nanardon, 13 years ago
  • session are valid for 24 hours
  • delete expired sessions
File size: 2.5 KB
Line 
1package Sophie;
2use Moose;
3use namespace::autoclean;
4use Catalyst::Runtime 5.80;
5use Sophie::Base;
6
7# Set flags and add plugins for the application
8#
9#         -Debug: activates the debug mode for very useful log messages
10#   ConfigLoader: will load the configuration from a Config::General file in the
11#                 application's home directory
12# Static::Simple: will serve static files from the application's root
13#                 directory
14
15use Catalyst qw/
16    ConfigLoader
17    Static::Simple
18    Session
19    Session::Store::DBI
20    Session::State::Cookie
21    Compress::Zlib
22    Server
23    Server::XMLRPC
24    Authentication
25    Authorization::Roles
26    Prototype
27/;
28
29use RPC::XML;
30$RPC::XML::FORCE_STRING_ENCODING = 1;
31
32extends 'Catalyst';
33
34our $VERSION = '0.01';
35$VERSION = eval $VERSION;
36
37# Configure the application.
38#
39# Note that settings in sophie.conf (or other external
40# configuration file that you set up manually) take precedence
41# over this when using ConfigLoader. Thus configuration
42# details given here can function as a default configuration,
43# with an external configuration file acting as an override for
44# local deployment.
45
46__PACKAGE__->config(
47    name => 'Sophie',
48    # Disable deprecated behavior needed by old applications
49    disable_component_resolution_regex_fallback => 1,
50    default_view => 'TT',
51    xmlrpc => {
52        xml_encoding => 'UTF-8',
53    },
54
55    'authentication' => {
56        default_realm => 'members',
57        realms => {
58            members => {
59                credential => {
60                    class => 'Password',
61                    password_field => 'password',
62                    password_type => 'crypted'
63                },
64                store => {
65                    class => 'DBIx::Class',
66                    user_model => 'Base::Users',
67                    role_relation => 'Roles',
68                    role_field => 'rolename',
69                    id_field => 'mail',
70                    # use_userdata_from_session => 1,
71                },
72            },
73        },
74    },
75);
76
77__PACKAGE__->config->{session} = {
78    expires   => 3600 * 24, # one day
79    dbi_dbh   => 'Session',
80    dbi_table => 'sessions',
81};
82
83# Start the application
84__PACKAGE__->setup();
85
86=head1 NAME
87
88Sophie - Catalyst based application
89
90=head1 SYNOPSIS
91
92    script/sophie_server.pl
93
94=head1 DESCRIPTION
95
96[enter your description here]
97
98=head1 SEE ALSO
99
100L<Sophie::Controller::Root>, L<Catalyst>
101
102=head1 AUTHOR
103
104Olivier Thauvin
105
106=head1 LICENSE
107
108This library is free software. You can redistribute it and/or modify
109it under the same terms as Perl itself.
110
111=cut
112
1131;
Note: See TracBrowser for help on using the repository browser.