createAuthenticationFailureHandler example

return self::PRIORITY;
    }

    public function getKey(): string
    {
        return 'access_token';
    }

    public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, ?string $userProviderId): string
    {
        $successHandler = isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container$firewallName$config)) : null;
        $failureHandler = isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container$firewallName$config)) : null;
        $authenticatorId = sprintf('security.authenticator.access_token.%s', $firewallName);
        $extractorId = $this->createExtractor($container$firewallName$config['token_extractors']);
        $tokenHandlerId = $this->createTokenHandler($container$firewallName$config['token_handler']$userProviderId);

        $container
            ->setDefinition($authenticatorIdnew ChildDefinition('security.authenticator.access_token'))
            ->replaceArgument(0, new Reference($tokenHandlerId))
            ->replaceArgument(1, new Reference($extractorId))
            ->replaceArgument(2, $userProviderId ? new Reference($userProviderId) : null)
            ->replaceArgument(3, $successHandler)
            ->replaceArgument(4, $failureHandler)
            
return 0;
    }

    public function getKey(): string
    {
        return 'stub';
    }

    public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
    {
        $this->createAuthenticationSuccessHandler($container$firewallName$config);
        $this->createAuthenticationFailureHandler($container$firewallName$config);

        return 'stub_authenticator_id';
    }
}
return 'json-login';
    }

    public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
    {
        $authenticatorId = 'security.authenticator.json_login.'.$firewallName;
        $options = array_intersect_key($config$this->options);
        $container
            ->setDefinition($authenticatorIdnew ChildDefinition('security.authenticator.json_login'))
            ->replaceArgument(1, new Reference($userProviderId))
            ->replaceArgument(2, isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container$firewallName$config)) : null)
            ->replaceArgument(3, isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container$firewallName$config)) : null)
            ->replaceArgument(4, $options);

        return $authenticatorId;
    }
}

        if (isset($config['csrf_token_generator'])) {
            throw new InvalidConfigurationException('The "csrf_token_generator" on "form_login" does not exist, use "enable_csrf" instead.');
        }

        $authenticatorId = 'security.authenticator.form_login.'.$firewallName;
        $options = array_intersect_key($config$this->options);
        $authenticator = $container
            ->setDefinition($authenticatorIdnew ChildDefinition('security.authenticator.form_login'))
            ->replaceArgument(1, new Reference($userProviderId))
            ->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container$firewallName$config)))
            ->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container$firewallName$config)))
            ->replaceArgument(4, $options);

        if ($options['use_forward'] ?? false) {
            $authenticator->addMethodCall('setHttpKernel', [new Reference('http_kernel')]);
        }

        return $authenticatorId;
    }
}
return 'dummy_form_login';
    }

    public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string
    {
        $authenticatorId = 'security.authenticator.dummy_form_login.'.$firewallName;
        $options = array_intersect_key($config$this->options);
        $authenticator = $container
            ->setDefinition($authenticatorIdnew ChildDefinition('security.authenticator.form_login'))
            ->replaceArgument(1, new Reference($userProviderId))
            ->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container$firewallName$config)))
            ->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container$firewallName$config)))
            ->replaceArgument(4, $options);

        if ($options['use_forward'] ?? false) {
            $authenticator->addMethodCall('setHttpKernel', [new Reference('http_kernel')]);
        }

        return $authenticatorId;
    }
}
->replaceArgument(1, new Reference($userProviderId))
            ->replaceArgument(2, new Reference($signatureHasherId))
            ->replaceArgument(3, $linkerOptions)
            ->addTag('security.authenticator.login_linker', ['firewall' => $firewallName])
        ;

        $authenticatorId = 'security.authenticator.login_link.'.$firewallName;
        $container
            ->setDefinition($authenticatorIdnew ChildDefinition('security.authenticator.login_link'))
            ->replaceArgument(0, new Reference($linkerId))
            ->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container$firewallName$config)))
            ->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container$firewallName$config)))
            ->replaceArgument(4, [
                'check_route' => $config['check_route'],
                'check_post_only' => $config['check_post_only'],
            ]);

        return $authenticatorId;
    }

    public function getPriority(): int
    {
        return self::PRIORITY;
    }
Home | Imprint | This part of the site doesn't use cookies.