public function requestApiKeyAction(Request $request)
    {
        /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        $credentials = [];
        if ($request->request->has('login')) {
            $credentials[$this->getPropertyName(ClassMetadata::LOGIN_PROPERTY)] = $request->request->get('login');
        }
        if ($request->request->has('password')) {
            $credentials[$this->getPropertyName(ClassMetadata::PASSWORD_PROPERTY)] = $request->request->get('password');
        }
        [$user, $exception] = $this->processAuthentication($credentials);

        /** @var OnAssembleResponseEvent $result */
        $result = $dispatcher->dispatch(
            Ma27ApiKeyAuthenticationEvents::ASSEMBLE_RESPONSE,
            new OnAssembleResponseEvent($user, $exception)
        );

        if (!$response = $result->getResponse()) {
            throw new HttpException(
                Response::HTTP_INTERNAL_SERVER_ERROR,
                'Cannot assemble the response!',
                $exception
            );
        }

        return $response;
    }
public function requestApiKeyAction(Request $request)
    {
        /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        $credentials = [];
        if ($request->request->has('login')) {
            $credentials[$this->getPropertyName(ClassMetadata::LOGIN_PROPERTY)] = $request->request->get('login');
        }
        if ($request->request->has('password')) {
            $credentials[$this->getPropertyName(ClassMetadata::PASSWORD_PROPERTY)] = $request->request->get('password');
        }
        [$user, $exception] = $this->processAuthentication($credentials);

        /** @var OnAssembleResponseEvent $result */
        $result = $dispatcher->dispatch(
            Ma27ApiKeyAuthenticationEvents::ASSEMBLE_RESPONSE,
            new OnAssembleResponseEvent($user, $exception)
        );

        if (!$response = $result->getResponse()) {
            throw new HttpException(
                Response::HTTP_INTERNAL_SERVER_ERROR,
                'Cannot assemble the response!',
                $exception
            );
        }

        return $response;
    }
public function requestApiKeyAction ( Request $ request ) { /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ $ dispatcher = $ this -> get ( 'event_dispatcher' ) ; $ credentials = [ ] ; if ( $ request -> request -> has ( 'login' ) ) { $ credentials [ $ this -> getPropertyName ( ClassMetadata :: LOGIN_PROPERTY ) ] = $ request -> request -> get ( 'login' ) ; } if ( $ request -> request -> has ( 'password' ) ) { $ credentials [ $ this -> getPropertyName ( ClassMetadata :: PASSWORD_PROPERTY ) ] = $ request -> request -> get ( 'password' ) ; } [ $ user , $ exception ] = $ this -> processAuthentication ( $ credentials ) ; /** @var OnAssembleResponseEvent $result */ $ result = $ dispatcher -> dispatch ( Ma27ApiKeyAuthenticationEvents :: ASSEMBLE_RESPONSE , new OnAssembleResponseEvent ( $ user , $ exception ) ) ; if ( ! $ response = $ result -> getResponse ( ) ) { throw new HttpException ( Response :: HTTP_INTERNAL_SERVER_ERROR , 'Cannot assemble the response!' , $ exception ) ; } return $ response ; }
Requests an api key.

@param Request $request

@throws HttpException If the login fails.

@return JsonResponse
Requests an api key .