68
|
1 package IMPL::Web::QueryHandler::AuthCookie;
|
|
2
|
|
3 use base qw(IMPL::Web::QueryHandler);
|
|
4 use Digest::MD5 qw(md5_hex);
|
|
5
|
|
6 use IMPL::Class::Property;
|
|
7
|
|
8 BEGIN {
|
|
9 public property salt => prop_all;
|
|
10 }
|
|
11
|
|
12 sub Process {
|
|
13 my ($this,$action,$nextHandler) = @_;
|
|
14
|
|
15 my $method = $action->query->cookie('method') || 'simple';
|
|
16
|
|
17 if ($method eq 'simple') {
|
|
18
|
|
19 if ($action->query->cookie('sign') eq md5_hex(
|
|
20 $this->salt,
|
|
21 $action->query->cookie('sid'),
|
|
22 $this->salt
|
|
23 ) ) {
|
|
24
|
|
25 my $context = $action->application->security->Session($action->query->cookie('sid'));
|
|
26
|
|
27 $context->auth->
|
|
28
|
|
29 }
|
|
30
|
|
31 } else {
|
|
32 die new IMPL::Exception("Unknown auth method",$method);
|
|
33 }
|
|
34 }
|
|
35
|
|
36
|
|
37 1; |