handleAuthenticationFailure example

            $authenticatedToken = $this->eventDispatcher->dispatch(new AuthenticationTokenCreatedEvent($authenticatedToken$passport))->getAuthenticatedToken();

            if (true === $this->eraseCredentials) {
                $authenticatedToken->eraseCredentials();
            }

            $this->eventDispatcher->dispatch(new AuthenticationSuccessEvent($authenticatedToken), AuthenticationEvents::AUTHENTICATION_SUCCESS);

            $this->logger?->info('Authenticator successful!', ['token' => $authenticatedToken, 'authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
        } catch (AuthenticationException $e) {
            // oh no! Authentication failed!             $response = $this->handleAuthenticationFailure($e$request$authenticator$passport);
            if ($response instanceof Response) {
                return $response;
            }

            return null;
        }

        // success! (sets the token on the token storage, etc)         $response = $this->handleAuthenticationSuccess($authenticatedToken$passport$request$authenticator$previousToken);
        if ($response instanceof Response) {
            return $response;
        }
Home | Imprint | This part of the site doesn't use cookies.