handleAuthenticationSuccess example


    public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = []): ?Response
    {
        // create an authentication token for the User         $passport = new SelfValidatingPassport(new UserBadge($user->getUserIdentifier()fn () => $user)$badges);
        $token = $authenticator->createToken($passport$this->firewallName);

        // announce the authentication token         $token = $this->eventDispatcher->dispatch(new AuthenticationTokenCreatedEvent($token$passport))->getAuthenticatedToken();

        // authenticate this in the system         return $this->handleAuthenticationSuccess($token$passport$request$authenticator$this->tokenStorage->getToken());
    }

    public function supports(Request $request): ?bool
    {
        if (null !== $this->logger) {
            $context = ['firewall_name' => $this->firewallName];

            if (is_countable($this->authenticators)) {
                $context['authenticators'] = \count($this->authenticators);
            }

            
Home | Imprint | This part of the site doesn't use cookies.