diff Lib/IMPL/Web/Handler/SecureCookie.pm @ 238:b8c724f6de36

DOM model refactoring TT view refactoring, controls are no longer derived from DOM nodes bugfixes
author sergey
date Tue, 16 Oct 2012 01:33:06 +0400
parents 3cebcf6fdb9b
children 23daf2fae33a
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/SecureCookie.pm	Mon Oct 15 17:39:12 2012 +0400
+++ b/Lib/IMPL/Web/Handler/SecureCookie.pm	Tue Oct 16 01:33:06 2012 +0400
@@ -8,7 +8,7 @@
 use IMPL::declare {
     require => {
         SecurityContext => 'IMPL::Security::Context',
-        User => 'IMPL::Security::User',
+        User => 'IMPL::Security::Principal',
         AuthSimple => 'IMPL::Security::Auth::Simple',
         Exception => 'IMPL::Exception',
         OperationException => '-IMPL::InvalidOperationException',
@@ -21,7 +21,7 @@
     },
     props => [  
         salt => PROP_RO,
-        manager => PROP_RO,
+        _manager => PROP_RO,
         _cookies => PROP_RW
     ]
 };
@@ -38,6 +38,7 @@
     return unless $nextHandler;
     
     my $context;
+    $this->_manager($action->application->security);
     
         
     my $sid = $action->cookie('sid',qr/(\w+)/); 
@@ -56,12 +57,12 @@
         )
     ) {
         # TODO: add a DefferedProxy to deffer a request to a data source
-        if ( $context = $this->manager->GetSession($sid) ) {
+        if ( $context = $this->_manager->GetSession($sid) ) {
         
             if ( eval { $context->auth->isa(AuthSimple) } ) {
                 my ($result,$challenge) = $context->auth->DoAuth($cookie);
                 
-                $action->manager->SaveSession($context);
+                $action->_manager->SaveSession($context);
                 
                 if ($result == AUTH_FAIL) {
                     $context = undef;
@@ -73,7 +74,7 @@
     
     $context ||= SecurityContext->new(principal => User->nobody, authority => $this);
     
-    my $httpResponse = $context->Impersonate($nextHandler);
+    my $httpResponse = $context->Impersonate($nextHandler,$action);
     
     die OperationException->new("A HttpResponse instance is expected")
         unless ref $httpResponse && eval { $httpResponse->isa(HttpResponse) };
@@ -90,9 +91,9 @@
     $this->_cookies({
         sid => $sid,
         sdata => $cookie
-    })
+    });
 
-    my $context = $this->$manager->CreateSession(
+    my $context = $this->_manager->CreateSession(
         sessionId => $sid,
         principal => $user,
         auth => AuthSimple->Create(password => $cookie),
@@ -108,7 +109,7 @@
 sub WriteResponse {
     my ($this,$response) = @_;
     
-    if (my $data $this->_cookies) {
+    if (my $data = $this->_cookies) {
 
         my $sign = md5_hex(
             $this->salt,
@@ -152,10 +153,6 @@
 
 Скаляр, использующийся для подписи данных.
 
-=head2 C<[get,set] manager>
-
-Реализация менеджера безопасности, отвечающая за реализацию взаимодействия с
-моделью безопасности. 
 
 =head2 C<InitSession($user,$auth,$roles)>