Example #1
0
 public function onAfterAuthentication(SecurityEvent $event)
 {
     $service = $event->getService();
     $adapter = $service->getAuthenticationManager()->getAdapter();
     if (!$adapter instanceof Http || !$this->response instanceof Response) {
         return;
     }
     RequestBridge::sendHeaders($this->response);
 }
Example #2
0
 public function onUserLoaded(SecurityEvent $event)
 {
     $service = $event->getService();
     $user = $event->user;
     if (!is_object($user) || !$user instanceof AclAware) {
         return;
     }
     $acl = $service->getAclManager();
     if (!$acl->hasRole($user->getRoleId())) {
         $acl->addRole($user, $user->getRoles());
         if ($acl->hasProvider()) {
             $acl->loadResources($acl->getProvider(), $user, true);
             $acl->loadPermissions($acl->getProvider(), $user, true);
         }
     }
 }
Example #3
0
 /**
  * Notifies a SecurityEvent
  *
  * @param string $eventName
  * @param array  $data
  *
  * @return void
  */
 protected function notifyEvent($eventName, array $data = array())
 {
     $this->notify(SecurityEvent::factory($eventName, $this, $data));
 }