expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('The security option "always_authenticate_before_granting" cannot be used when "enable_authenticator_manager" is set to true. If you rely on this behavior, set it to false.');
@@ -559,7 +561,7 @@ public function provideConfigureCustomAuthenticatorData()
];
}
- public function testCompilesWithoutSessionListenerWithStatelessFirewallWithAuthenticationManager()
+ public function testCompilesWithoutSessionListenerWithStatelessFirewallWithAuthenticatorManager()
{
$container = $this->getRawContainer();
@@ -580,7 +582,7 @@ public function testCompilesWithoutSessionListenerWithStatelessFirewallWithAuthe
$this->assertFalse($container->has('security.listener.session.'.$firewallId));
}
- public function testCompilesWithSessionListenerWithStatefulllFirewallWithAuthenticationManager()
+ public function testCompilesWithSessionListenerWithStatefulllFirewallWithAuthenticatorManager()
{
$container = $this->getRawContainer();
@@ -601,6 +603,37 @@ public function testCompilesWithSessionListenerWithStatefulllFirewallWithAuthent
$this->assertTrue($container->has('security.listener.session.'.$firewallId));
}
+ /**
+ * @dataProvider provideUserCheckerConfig
+ */
+ public function testUserCheckerWithAuthenticatorManager(array $config, string $expectedUserCheckerClass)
+ {
+ $container = $this->getRawContainer();
+ $container->register(TestUserChecker::class);
+
+ $container->loadFromExtension('security', [
+ 'enable_authenticator_manager' => true,
+ 'firewalls' => [
+ 'main' => array_merge([
+ 'pattern' => '/.*',
+ 'http_basic' => true,
+ ], $config),
+ ],
+ ]);
+
+ $container->compile();
+
+ $userCheckerId = (string) $container->getDefinition('security.listener.user_checker.main')->getArgument(0);
+ $this->assertTrue($container->has($userCheckerId));
+ $this->assertEquals($expectedUserCheckerClass, $container->findDefinition($userCheckerId)->getClass());
+ }
+
+ public function provideUserCheckerConfig()
+ {
+ yield [[], UserChecker::class];
+ yield [['user_checker' => TestUserChecker::class], TestUserChecker::class];
+ }
+
protected function getRawContainer()
{
$container = new ContainerBuilder();
@@ -689,3 +722,14 @@ public function supportsRememberMe()
{
}
}
+
+class TestUserChecker implements UserCheckerInterface
+{
+ public function checkPreAuth(UserInterface $user)
+ {
+ }
+
+ public function checkPostAuth(UserInterface $user)
+ {
+ }
+}
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy