Skip to content

Commit 1e9f63f

Browse files
chalasrfabpot
authored andcommitted
[Security] Allow to set a check_path on json_login listener
1 parent 21c90c5 commit 1e9f63f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

DependencyInjection/Security/Factory/JsonLoginFactory.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* JsonLoginFactory creates services for JSON login authentication.
2020
*
2121
* @author Kévin Dunglas <dunglas@gmail.com>
22+
*
23+
* @experimental in version 3.3
2224
*/
2325
class JsonLoginFactory extends AbstractFactory
2426
{
@@ -83,10 +85,10 @@ protected function createListener($container, $id, $config, $userProvider)
8385
{
8486
$listenerId = $this->getListenerId();
8587
$listener = new ChildDefinition($listenerId);
86-
$listener->replaceArgument(2, $id);
87-
$listener->replaceArgument(3, new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)));
88-
$listener->replaceArgument(4, new Reference($this->createAuthenticationFailureHandler($container, $id, $config)));
89-
$listener->replaceArgument(5, array_intersect_key($config, $this->options));
88+
$listener->replaceArgument(3, $id);
89+
$listener->replaceArgument(4, new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)));
90+
$listener->replaceArgument(5, new Reference($this->createAuthenticationFailureHandler($container, $id, $config)));
91+
$listener->replaceArgument(6, array_intersect_key($config, $this->options));
9092

9193
$listenerId .= '.'.$id;
9294
$container->setDefinition($listenerId, $listener);

Resources/config/security_listeners.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
<tag name="monolog.logger" channel="security" />
148148
<argument type="service" id="security.token_storage" />
149149
<argument type="service" id="security.authentication.manager" />
150+
<argument type="service" id="security.http_utils" />
150151
<argument /> <!-- Provider-shared Key -->
151152
<argument type="service" id="security.authentication.success_handler" />
152153
<argument type="service" id="security.authentication.failure_handler" />

Tests/Functional/app/JsonLogin/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ security:
1616
pattern: ^/
1717
anonymous: true
1818
json_login:
19-
check_path: /mychk
19+
check_path: /chk
2020
username_path: user.login
2121
password_path: user.password
2222

0 commit comments

Comments
 (0)