Mercurial > pub > Impl
comparison Lib/IMPL/Web/QueryHandler/SecureCookie.pm @ 97:964587c5183c
Added SecureCall to Web QueryHandlers stack
many bug fixes to Security and Web Application modules
author | wizard |
---|---|
date | Tue, 04 May 2010 04:04:37 +0400 |
parents | 67eb8eaec3d4 |
children | a9f4ba4783eb |
comparison
equal
deleted
inserted
replaced
96:4c55aed00ff2 | 97:964587c5183c |
---|---|
21 sub Process { | 21 sub Process { |
22 my ($this,$action,$nextHandler) = @_; | 22 my ($this,$action,$nextHandler) = @_; |
23 | 23 |
24 return undef unless $nextHandler; | 24 return undef unless $nextHandler; |
25 | 25 |
26 local $IMPL::Security::authority = $this; | |
27 | |
26 my $method = $action->query->cookie('method') || 'simple'; | 28 my $method = $action->query->cookie('method') || 'simple'; |
27 | 29 |
28 if ($method eq 'simple') { | 30 if ($method eq 'simple') { |
29 | 31 |
30 my $sid = $action->query->cookie('sid'); | 32 my $sid = $action->query->cookie('sid'); |
40 $sid, | 42 $sid, |
41 $cookie, | 43 $cookie, |
42 $this->salt | 44 $this->salt |
43 ) | 45 ) |
44 ) { | 46 ) { |
45 local $IMPL::Security::authority = $this; | |
46 | |
47 my $context = $action->application->security->sourceSession->find( | 47 my $context = $action->application->security->sourceSession->find( |
48 { id => $sid } | 48 { id => $sid } |
49 ) or return $nextHandler->(); | 49 ) or return $nextHandler->(); |
50 | 50 |
51 my ($result,$challenge) = $context->auth->ValidateSession($cookie); | 51 my ($result,$challenge) = $context->auth->ValidateSession($cookie); |
54 $context->authority($this); | 54 $context->authority($this); |
55 return $context->Impersonate($nextHandler); | 55 return $context->Impersonate($nextHandler); |
56 } else { | 56 } else { |
57 return $nextHandler->(); | 57 return $nextHandler->(); |
58 } | 58 } |
59 } else { | |
60 return $nextHandler->(); | |
59 } | 61 } |
60 } else { | 62 } else { |
61 die new IMPL::Exception("Unknown auth method",$method); | 63 return $nextHandler->(); |
62 } | 64 } |
63 } | 65 } |
64 | 66 |
65 sub WriteResponse { | 67 sub WriteResponse { |
66 my ($this,$response,$sid,$cookie,$method) = @_; | 68 my ($this,$response,$sid,$cookie,$method) = @_; |
70 $sid, | 72 $sid, |
71 $cookie, | 73 $cookie, |
72 $this->salt | 74 $this->salt |
73 ); | 75 ); |
74 | 76 |
75 $this->setCookie(sid => $sid); | 77 $response->setCookie(sid => $sid); |
76 $this->setCookie(sdata => $cookie); | 78 $response->setCookie(sdata => $cookie); |
77 $this->setCookie(sign => $sign); | 79 $response->setCookie(sign => $sign); |
78 $this->setCookie(method => $method) if $method; | 80 $response->setCookie(method => $method) if $method; |
79 } | 81 } |
80 | 82 |
81 1; | 83 1; |
82 | 84 |
83 __END__ | 85 __END__ |