]> wagnertech.de Git - mfinanz.git/blob - SL/Dispatcher/AuthHandler/None.pm
restart apache2 in postinst
[mfinanz.git] / SL / Dispatcher / AuthHandler / None.pm
1 package SL::Dispatcher::AuthHandler::None;
2
3 use strict;
4 use parent qw(SL::Dispatcher::AuthHandler::Base);
5
6 use SL::Auth::Constants;
7
8 sub handle {
9   my ($self) = @_;
10
11
12   my ($http_auth_login,     $http_auth_password) = $self->_parse_http_basic_auth;
13   my ($http_headers_client, $http_headers_login) = $self->_parse_http_headers_auth;
14
15   my $client_id = $http_headers_client // $::auth->get_default_client_id;
16   my $login     = $http_headers_login  // $http_auth_login;
17
18   if ($client_id && $login) {
19     $::auth->set_client($client_id);
20     %::myconfig = User->get_default_myconfig($::auth->read_user(login => $login));
21
22     $::auth->create_or_refresh_session;
23     $::auth->set_session_value('client_id', $client_id);
24     $::auth->set_session_value('login',     $login);
25
26     $::auth->set_session_authenticated($login, SL::Auth::Constants::SESSION_OK());
27
28   } else {
29     %::myconfig = User->get_default_myconfig;
30   }
31
32   return 1;
33 }
34
35 1;