diff 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
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/SecureCookie.pm	Sat Jun 15 02:32:11 2013 +0400
+++ b/Lib/IMPL/Web/Handler/SecureCookie.pm	Wed Jun 19 03:25:44 2013 +0400
@@ -57,7 +57,7 @@
     return unless $nextHandler;
     
     my $context;
-    $this->_manager($action->application->security);
+    $this->_manager($action->application->security->new());
     
         
     my $sid = $action->cookie('sid',qr/(\w+)/); 
@@ -84,7 +84,12 @@
     
     $context ||= SecurityContext->new(principal => User->nobody, authority => $this);
     
-    my $httpResponse = $context->Impersonate($nextHandler,$action);
+    my $httpResponse = eval { $context->Impersonate($nextHandler,$action); };
+    my $e = $@;
+    
+    $this->_manager->Dispose();
+    
+    die $e if $e;
     
     die OperationException->new("A HttpResponse instance is expected")
         unless ref $httpResponse && eval { $httpResponse->isa(HttpResponse) };