errorResponseFactory = $errorResponseFactory; } /** * {@inheritdoc } */ abstract public function supports(Request $request): ?bool; /** * {@inheritdoc } */ abstract public function authenticate(Request $request): Passport; /** * {@inheritdoc } */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response { $error = new Error(); $error->message = $exception->getMessageKey(); return $this->errorResponseFactory->create($error,Response::HTTP_FORBIDDEN); } /** * {@inheritdoc } */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey): ?Response { return null; } }