Mercurial > pub > Impl
comparison Lib/IMPL/Web/QueryHandler/AuthCookie.pm @ 68:739f1288ca84
Auth in progress
| author | wizard |
|---|---|
| date | Tue, 23 Mar 2010 16:55:25 +0300 |
| parents | |
| children | 8c7b88bdb663 |
comparison
equal
deleted
inserted
replaced
| 67:9f5795a10939 | 68:739f1288ca84 |
|---|---|
| 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; |
