Authenticates the user.

@param FilterUserResponseEvent  $event
@param string                   $eventName
@param EventDispatcherInterface $dispatcher
973912
public function authenticate(FilterUserResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        try {
            $this->loginManager->logInUser($this->firewallName, $event->getUser(), $event->getResponse());

            $dispatcher->dispatch(Events::SECURITY_IMPLICIT_LOGIN, new UserEvent($event->getUser(), $event->getRequest()));
        } catch (AccountStatusException $e) {
            // We simply do not authenticate users which do not pass the user
            // checker (not enabled, expired, etc.).
        }
    }
1364774
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $response = $event->getResponse();

        if (null === $response->getCharset()) {
            $response->setCharset($this->charset);
        }

        $response->prepare($event->getRequest());
    }
1213912
public function onAddToQueueListenerQuery(AddToQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $query          = $event->getQuery();
        $eventToSave    = $event->getEvent();
        $eventToSave    = serialize($eventToSave);
        $eventToSave    = urlencode($eventToSave);  // Ohne urlencode speichert Contao das serialisierte Event nicht!
        $kind           = $event->getKind();
        $priotity       = $event->getPriority();
        $srcmodule      = $event->getSrcmodule();
        $srctable       = $event->getSrctable();
        $srcid          = $event->getSrcid();
        $interval       = $event->getIntervalkind();
        $query         .= "tstamp = " . time();
        $query         .= ", kind = '$kind'";
        $query         .= ", priority = $priotity";
        $query         .= ", data = '$eventToSave'";
        $query         .= ", srcmodule = '$srcmodule'";
        $query         .= ", srcid = $srcid";
        $query         .= ", srctable = '$srctable'";
        $query         .= ", intervalkind = '$interval'";
        $event->setQuery($query);
    }
747638
public function onResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $debug = $request->query->get('debug');
        $response = $event->getResponse();

        //this is for debug purpose
        if ($response instanceof JsonResponse && $debug) {
            $new = new Response();
            $new->setContent('<body>'.$response->getContent().'</body>');
            $event->setResponse($new);
        }
    }
857203
public function onResponseEarly(FilterResponseEvent $event)
    {
        if (!$this->eventRequestMatches($event)) {
            return;
        }
        $event->setResponse($this->responseTransformer->transformEarly($event->getRequest(), $event->getResponse()));
    }
1276343
public function subscribe(Dispatcher $events)
    {
        $events->listen(LoginEvent::class, UserAuthListener::class . '@onUserLogin');
        $events->listen(LogoutEvent::class, UserAuthListener::class . '@onUserLogout');
    }
1108506
public function onRegistrationConfirm(GetResponseUserEvent $event)
    {
        if (null === $event->getResponse()) {
            $url = $this->router->generate('fos_user_security_login');
            $event->setResponse(new RedirectResponse($url));
        }
    }
1078820
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($this->encryptionService->isPerUserEncryptionEnabled()) {
            $request = $event->getRequest();

            // Check if this is one of the security_check routes
            $securityCheckRoutes = $this->settings['security_check_routes'];
            $route = $request->attributes->get('_route');
            if ($route && in_array($route, $securityCheckRoutes)) {
                $user = $this->getUser();

                if ($user) {
                    $password = $request->request->get('_password');
                    $privateKey = $this->keyManager->getUserPrivateKey($user, array('password' => $password));
                    if ($privateKey) {
                        $request->getSession()->set(KeyManager::SESSION_PRIVATE_KEY_PARAM, $privateKey);
                    }
                    else {
                        throw new EncryptionException('Could not load user\'s key');
                    }
                }
            }
        }
    }
1357198
public function onResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();

        $this->setFrameOptions($request, $response);
    }
1053455
public function onGetUser(GetUserForTokenEvent $event)
    {
        $userProvider = $event->getUserProvider();

        if (!$userProvider instanceof OAuthUserProviderInterface) {
            return;
        }

        $token = $event->getToken();

        if ($user = $userProvider->loadUserByOAuthCredentials($token)) {
            $token->setUser($user);
        }
    }
963040
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $response = $event->getResponse();

        if ($response instanceof StreamedResponse) {
            $response->send();
        }
    }
1250198
public function create(CouponCreateOrUpdateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $coupon = new CouponModel();

        $this->createOrUpdate($coupon, $event, $dispatcher);
    }
594529
public function onKernelResponse(FilterResponseEvent $event)
    {
        $event->getResponse()->headers->set(self::HEADER_NAME, $this->requestId->get());
    }
442047
public function onKernelResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $routeName = $request->attributes->get('_route');
        if (!$route = $this->app['routes']->get($routeName)) {
            return;
        }

        foreach ((array) $route->getOption('_after_middlewares') as $callback) {
            $response = call_user_func($this->app['callback_resolver']->resolveCallback($callback), $request, $event->getResponse(), $this->app);
            if ($response instanceof Response) {
                $event->setResponse($response);
            } elseif (null !== $response) {
                throw new \RuntimeException(sprintf('An after middleware for route "%s" returned an invalid response value. Must return null or an instance of Response.', $routeName));
            }
        }
    }
1195966
public function onQueueResponseListenerGenerate(
        QueueResponseEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $queueName          = $event->getQueueName();
        $kind               = $event->getKind();
        $content            = $event->getContent();
        $msgKey             = 'con4gis - QueueMessage';
        $msgType            = $queueName . '_' . $kind;
        $param              = $event->getParam();
        $param['queueName'] = $queueName;
        $param['kind']      = $kind;
        $param['content']   = $content;
        $param['msgKey']    = $msgKey;
        $param['msgType']   = $msgType;

        if (class_exists('Notification')) {
            $notifications = Notification::findByType($msgType);

            if ($notifications !== null) {
                while ($notifications->next()) {
                    $notifications->current()
                                  ->send($param);
                }
            }
        }
    }
848182
public function updateAccessoryPosition(UpdatePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        return $this->genericUpdatePosition(AccessoryQuery::create(), $event, $dispatcher);
    }
795628
public function onKernelResponse(FilterResponseEvent $event)
    {
        $lockName = $event->getRequest()->attributes->get('writeLockOn', null);
        if (!is_null($lockName)) {
            $this->cache->delete($lockName);
            $this->logger->info("LOCK REMOVED = ".$lockName);
        }
    }