public function onResponseCreation(OnAssembleResponseEvent $event)
    {
        if ($event->isSuccess()) {
            $event->setResponse(new JsonResponse(array(
                $this->apiKeyValue => $this->metadata->getPropertyValue($event->getUser(), ClassMetadata::API_KEY_PROPERTY),
            )));

            return;
        }

        $event->setResponse(new JsonResponse(
            array($this->messageValue => $this->translator->trans($event->getException()->getMessage() ?: 'Credentials refused!')),
            JsonResponse::HTTP_UNAUTHORIZED
        ));
    }
public function onResponseCreation(OnAssembleResponseEvent $event)
    {
        if ($event->isSuccess()) {
            $event->setResponse(new JsonResponse(array(
                $this->apiKeyValue => $this->metadata->getPropertyValue($event->getUser(), ClassMetadata::API_KEY_PROPERTY),
            )));

            return;
        }

        $event->setResponse(new JsonResponse(
            array($this->messageValue => $this->translator->trans($event->getException()->getMessage() ?: 'Credentials refused!')),
            JsonResponse::HTTP_UNAUTHORIZED
        ));
    }
public function onResponseCreation ( OnAssembleResponseEvent $ event ) { if ( $ event -> isSuccess ( ) ) { $ event -> setResponse ( new JsonResponse ( array ( $ this -> apiKeyValue => $ this -> metadata -> getPropertyValue ( $ event -> getUser ( ) , ClassMetadata :: API_KEY_PROPERTY ) , ) ) ) ; return ; } $ event -> setResponse ( new JsonResponse ( array ( $ this -> messageValue => $ this -> translator -> trans ( $ event -> getException ( ) -> getMessage ( ) ? : 'Credentials refused!' ) ) , JsonResponse :: HTTP_UNAUTHORIZED ) ) ; }
Assembles the response.

@param OnAssembleResponseEvent $event
Assembles the response .