src/Aptoma/Security/Http/Firewall/ApiKeyAuthenticationListener.php
public function handle(GetResponseEvent $event)
    {
        $apiKey = $this->getApiKeyFromQueryOrHeader($event->getRequest());

        if (false === $apiKey) {
            return;
        }

        try {
            $token = $this->authenticationManager->authenticate(new ApiKeyToken($apiKey));
            $this->tokenStorage->setToken($token);
        } catch (AuthenticationException $failed) {
            $this->tokenStorage->setToken(null);
            $this->doFailureResponse($event);
        }
    }
public function handle(GetResponseEvent $event)
    {
        $apiKey = $this->getApiKeyFromQueryOrHeader($event->getRequest());

        if (false === $apiKey) {
            return;
        }

        try {
            $token = $this->authenticationManager->authenticate(new ApiKeyToken($apiKey));
            $this->tokenStorage->setToken($token);
        } catch (AuthenticationException $failed) {
            $this->tokenStorage->setToken(null);
            $this->doFailureResponse($event);
        }
    }
Handles API key authentication.

@param GetResponseEvent $event A GetResponseEvent instance