Mercurial > pub > Impl
changeset 340:c090d9102a38
web application security refactoring
author | cin |
---|---|
date | Fri, 21 Jun 2013 02:43:56 +0400 |
parents | 97628101b765 |
children | 70658970af15 |
files | Lib/IMPL/Web/Application/Action.pm Lib/IMPL/Web/Handler/SecureCookie.pm |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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")