annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
1 package IMPL::Web::QueryHandler::AuthCookie;
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
2
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
3 use base qw(IMPL::Web::QueryHandler);
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
4 use Digest::MD5 qw(md5_hex);
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
5
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
6 use IMPL::Class::Property;
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
7
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
8 BEGIN {
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
9 public property salt => prop_all;
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
10 }
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
11
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
12 sub Process {
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
13 my ($this,$action,$nextHandler) = @_;
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
14
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
15 my $method = $action->query->cookie('method') || 'simple';
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
16
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
17 if ($method eq 'simple') {
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
18
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
19 if ($action->query->cookie('sign') eq md5_hex(
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
20 $this->salt,
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
21 $action->query->cookie('sid'),
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
22 $this->salt
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
23 ) ) {
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
24
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
25 my $context = $action->application->security->Session($action->query->cookie('sid'));
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
26
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
27 $context->auth->
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
28
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
29 }
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
30
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
31 } else {
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
32 die new IMPL::Exception("Unknown auth method",$method);
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
33 }
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
34 }
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
35
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
36
739f1288ca84 Auth in progress
wizard
parents:
diff changeset
37 1;