Mercurial > pub > Impl
comparison Lib/IMPL/Web/QueryHandler/SecureCookie.pm @ 75:915df8fcd16f
docs
small fixes
author | wizard |
---|---|
date | Tue, 30 Mar 2010 20:31:36 +0400 |
parents | 84aa8c395fce |
children | 3d1f584aea60 |
comparison
equal
deleted
inserted
replaced
74:84aa8c395fce | 75:915df8fcd16f |
---|---|
11 } | 11 } |
12 | 12 |
13 sub CTOR { | 13 sub CTOR { |
14 my ($this) = @_; | 14 my ($this) = @_; |
15 | 15 |
16 | 16 $this->salt('DeadBeef') unless $this->salt; |
17 } | 17 } |
18 | 18 |
19 sub Process { | 19 sub Process { |
20 my ($this,$action,$nextHandler) = @_; | 20 my ($this,$action,$nextHandler) = @_; |
21 | |
22 return undef unless $nextHandler; | |
21 | 23 |
22 my $method = $action->query->cookie('method') || 'simple'; | 24 my $method = $action->query->cookie('method') || 'simple'; |
23 | 25 |
24 if ($method eq 'simple') { | 26 if ($method eq 'simple') { |
25 | 27 |
26 my $sid = $action->query->cookie('sid'); | 28 my $sid = $action->query->cookie('sid'); |
27 my $cookie = $action->query->cookie('cookie'); | 29 my $cookie = $action->query->cookie('sdata'); |
30 my $sign = $action->query->cookie('sign'); | |
28 | 31 |
29 if ($action->query->cookie('sign') eq md5_hex( | 32 if ( |
30 $this->salt, | 33 $sid and |
31 $sid, | 34 $cookie and |
32 $cookie, | 35 $sign and |
33 $this->salt | 36 $sign eq md5_hex( |
34 ) ) { | 37 $this->salt, |
38 $sid, | |
39 $cookie, | |
40 $this->salt | |
41 ) | |
42 ) { | |
35 | 43 |
36 my $context = $action->application->security->Session( | 44 my $context = $action->application->security->Session( |
37 id => $sid | 45 id => $sid |
38 ); | 46 ); |
39 | 47 |
48 } else { | 56 } else { |
49 die new IMPL::Exception("Unknown auth method",$method); | 57 die new IMPL::Exception("Unknown auth method",$method); |
50 } | 58 } |
51 } | 59 } |
52 | 60 |
61 1; | |
53 | 62 |
54 1; | 63 __END__ |
64 | |
65 =pod | |
66 | |
67 =head1 NAME | |
68 | |
69 C<IMPL::Web::QueryHandler::SecureCookie> | |
70 | |
71 =head1 DESCRIPTION | |
72 | |
73 C<use base qw(IMPL::Web::QueryHandler)> | |
74 | |
75 Возобновляет сессию пользователя на основе информации переданной через Cookie. | |
76 | |
77 Использует механизм подписи информации для проверки верности входных данных перед | |
78 началом каких-либо действий. | |
79 | |
80 Данный обработчик возвращает результат выполнения следдующего обработчика. | |
81 | |
82 =head1 MEMBERS | |
83 | |
84 =over | |
85 | |
86 =item C<[get,set] salt> | |
87 | |
88 Скаляр, использующийся для подписи данных. | |
89 | |
90 =back | |
91 | |
92 =cut |