processConfig example

$container = new ContainerBuilder();

        $config = [
            'check_route' => 'app_check_login_link',
            'lifetime' => 500,
            'signature_properties' => ['email', 'password'],
            'success_handler' => 'success_handler_service_id',
            'failure_handler' => 'failure_handler_service_id',
        ];

        $factory = new LoginLinkFactory();
        $finalizedConfig = $this->processConfig($config$factory);
        $factory->createAuthenticator($container, 'firewall1', $finalizedConfig, 'userprovider');

        $this->assertTrue($container->hasDefinition('security.authenticator.login_link'));
        $this->assertTrue($container->hasDefinition('security.authenticator.login_link_handler.firewall1'));
    }

    private function processConfig(array $config, LoginLinkFactory $factory)
    {
        $nodeDefinition = new ArrayNodeDefinition('login-link');
        $factory->addConfiguration($nodeDefinition);

        
public function testBasicServiceConfiguration()
    {
        $container = new ContainerBuilder();
        $config = [
            'token_handler' => 'in_memory_token_handler_service_id',
            'success_handler' => 'success_handler_service_id',
            'failure_handler' => 'failure_handler_service_id',
            'token_extractors' => ['BAR', 'FOO'],
        ];

        $factory = new AccessTokenFactory($this->createTokenHandlerFactories());
        $finalizedConfig = $this->processConfig($config$factory);

        $factory->createAuthenticator($container, 'firewall1', $finalizedConfig, 'userprovider');

        $this->assertTrue($container->hasDefinition('security.authenticator.access_token.firewall1'));
    }

    public function testDefaultTokenHandlerConfiguration()
    {
        $container = new ContainerBuilder();
        $config = [
            'token_handler' => 'in_memory_token_handler_service_id',
        ];
Home | Imprint | This part of the site doesn't use cookies.