-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[SecurityBundle] fix setLogoutOnUserChange calls for context listeners #25272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
d4a6f6c
98abd1e
fb42305
d9d7477
3ece4c6
4657298
8174c95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,12 +276,6 @@ private function createFirewalls($config, ContainerBuilder $container) | |
$customUserChecker = true; | ||
} | ||
|
||
if (!isset($firewall['logout_on_user_change']) || !$firewall['logout_on_user_change']) { | ||
@trigger_error(sprintf('Not setting "logout_on_user_change" to true on firewall "%s" is deprecated as of 3.4, it will always be true in 4.0.', $name), E_USER_DEPRECATED); | ||
} | ||
|
||
$contextListenerDefinition->addMethodCall('setLogoutOnUserChange', array($firewall['logout_on_user_change'])); | ||
|
||
$configId = 'security.firewall.map.config.'.$name; | ||
|
||
list($matcher, $listeners, $exceptionListener) = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId); | ||
|
@@ -370,7 +364,11 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a | |
$contextKey = $firewall['context']; | ||
} | ||
|
||
$listeners[] = new Reference($this->createContextListener($container, $contextKey)); | ||
if (!isset($firewall['logout_on_user_change']) || !$firewall['logout_on_user_change']) { | ||
@trigger_error(sprintf('Not setting "logout_on_user_change" to true on firewall "%s" is deprecated as of 3.4, it will always be true in 4.0.', $id), E_USER_DEPRECATED); | ||
} | ||
|
||
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $firewall['logout_on_user_change'])); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. must be reached only if the key is set on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not sure I follow. That line was always reached before as well?
👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now it's accessing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it did that also before 😉 I actually think the array key will always exist and it cannot be null? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot that it's a bool node, sorry for the noise! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem ;) will update the PR after work |
||
} | ||
|
||
$config->replaceArgument(6, $contextKey); | ||
|
@@ -481,7 +479,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a | |
return array($matcher, $listeners, $exceptionListener); | ||
} | ||
|
||
private function createContextListener($container, $contextKey) | ||
private function createContextListener($container, $contextKey, $logoutUserOnChange) | ||
{ | ||
if (isset($this->contextListeners[$contextKey])) { | ||
return $this->contextListeners[$contextKey]; | ||
|
@@ -490,6 +488,7 @@ private function createContextListener($container, $contextKey) | |
$listenerId = 'security.context_listener.'.count($this->contextListeners); | ||
$listener = $container->setDefinition($listenerId, new ChildDefinition('security.context_listener')); | ||
$listener->replaceArgument(2, $contextKey); | ||
$listener->addMethodCall('setLogoutOnUserChange', array($logoutUserOnChange)); | ||
|
||
return $this->contextListeners[$contextKey] = $listenerId; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those 2 lines can bu moved back to where they were, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 😉