comparison Lib/IMPL/Web/Handler/SecureCookie.pm @ 328:63709a4e6da0

Security framework refactoring
author cin
date Mon, 03 Jun 2013 03:28:01 +0400
parents 0f59b2de72af
children 97628101b765
comparison
equal deleted inserted replaced
327:6cb0d4d325d7 328:63709a4e6da0
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+)/);
66 66
67 if ( $this->ValidateCookie($sid,$cookie,$sign) ) { 67 if ( $this->ValidateCookie($sid,$cookie,$sign) ) {
68 # TODO: add a DefferedProxy to deffer a request to a data source 68 # TODO: add a DeferredProxy to deffer a request to a data source
69 if ( $context = $this->_manager->GetSession($sid) ) { 69 if ( $context = $this->_manager->sessions->GetById($sid) ) {
70 if ( eval { $context->auth->isa(AuthSimple) } ) { 70 if ( eval { $context->auth->isa(AuthSimple) } ) {
71 my ($result,$challenge) = $context->auth->DoAuth($cookie); 71 my ($result,$challenge) = $context->auth->DoAuth($cookie);
72 72
73 $context->authority($this); 73 $context->authority($this);
74 74
113 $this->_cookies({ 113 $this->_cookies({
114 sid => $sid, 114 sid => $sid,
115 sdata => $cookie 115 sdata => $cookie
116 }); 116 });
117 117
118 my $context = $this->_manager->CreateSession( 118 my $context = $this->_manager->sessions->Create({
119 sessionId => $sid, 119 sessionId => $sid,
120 principal => $user, 120 principal => $user,
121 auth => AuthSimple->Create(password => $cookie), 121 auth => AuthSimple->Create(password => $cookie),
122 authority => $this, 122 authority => $this,
123 rolesAssigned => $roles 123 rolesAssigned => $roles
124 ); 124 });
125 125
126 $context->Apply(); 126 $context->Apply();
127 127
128 } 128 }
129 129