# HG changeset patch # User cin # Date 1371768236 -14400 # Node ID c090d9102a38d96885f2911eaecc2c18434124f8 # Parent 97628101b765031cad2acd5313dc1f9e0077db7c web application security refactoring diff -r 97628101b765 -r c090d9102a38 Lib/IMPL/Web/Application/Action.pm --- a/Lib/IMPL/Web/Application/Action.pm Wed Jun 19 03:25:44 2013 +0400 +++ b/Lib/IMPL/Web/Application/Action.pm Fri Jun 21 02:43:56 2013 +0400 @@ -19,6 +19,7 @@ ], props => [ application => PROP_RW, + security => PROP_RW, query => PROP_RO, context => PROP_RW, _jsonData => PROP_RW, @@ -29,6 +30,8 @@ my ($this) = @_; $this->context({}); + $this->security($this->application->security->new()) + if $this->application->security; } sub cookie { @@ -173,6 +176,9 @@ sub Dispose { my ($this) = @_; + $this->security->Dispose() + if $this->security and $this->security->can('Dispose'); + $_->Dispose() foreach grep is($_,Disposable), values %{$this->context}; $this->next::method(); diff -r 97628101b765 -r c090d9102a38 Lib/IMPL/Web/Handler/SecureCookie.pm --- a/Lib/IMPL/Web/Handler/SecureCookie.pm Wed Jun 19 03:25:44 2013 +0400 +++ b/Lib/IMPL/Web/Handler/SecureCookie.pm Fri Jun 21 02:43:56 2013 +0400 @@ -57,7 +57,7 @@ return unless $nextHandler; my $context; - $this->_manager($action->application->security->new()); + $this->_manager($action->security); my $sid = $action->cookie('sid',qr/(\w+)/); @@ -87,8 +87,6 @@ my $httpResponse = eval { $context->Impersonate($nextHandler,$action); }; my $e = $@; - $this->_manager->Dispose(); - die $e if $e; die OperationException->new("A HttpResponse instance is expected")