comparison Lib/IMPL/Web/Handler/SecureCookie.pm @ 339:97628101b765

refactoring: application now holds a security object factory rather than a security object
author cin
date Wed, 19 Jun 2013 03:25:44 +0400
parents 63709a4e6da0
children c090d9102a38
comparison
equal deleted inserted replaced
338:c78dfbe658bd 339:97628101b765
55 my ($this,$action,$nextHandler) = @_; 55 my ($this,$action,$nextHandler) = @_;
56 56
57 return unless $nextHandler; 57 return unless $nextHandler;
58 58
59 my $context; 59 my $context;
60 $this->_manager($action->application->security); 60 $this->_manager($action->application->security->new());
61 61
62 62
63 my $sid = $action->cookie('sid',qr/(\w+)/); 63 my $sid = $action->cookie('sid',qr/(\w+)/);
64 my $cookie = $action->cookie('sdata',qr/(\w+)/); 64 my $cookie = $action->cookie('sdata',qr/(\w+)/);
65 my $sign = $action->cookie('sign',qw/(\w+)/); 65 my $sign = $action->cookie('sign',qw/(\w+)/);
82 82
83 } 83 }
84 84
85 $context ||= SecurityContext->new(principal => User->nobody, authority => $this); 85 $context ||= SecurityContext->new(principal => User->nobody, authority => $this);
86 86
87 my $httpResponse = $context->Impersonate($nextHandler,$action); 87 my $httpResponse = eval { $context->Impersonate($nextHandler,$action); };
88 my $e = $@;
89
90 $this->_manager->Dispose();
91
92 die $e if $e;
88 93
89 die OperationException->new("A HttpResponse instance is expected") 94 die OperationException->new("A HttpResponse instance is expected")
90 unless ref $httpResponse && eval { $httpResponse->isa(HttpResponse) }; 95 unless ref $httpResponse && eval { $httpResponse->isa(HttpResponse) };
91 96
92 return $this->WriteResponse($httpResponse); 97 return $this->WriteResponse($httpResponse);