Skip to content

Commit 218eb24

Browse files
committed
bug #34536 [SecurityBundle] Don't require a user provider for the anonymous listener (chalasr)
This PR was merged into the 4.4 branch. Discussion ---------- [SecurityBundle] Don't require a user provider for the anonymous listener | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34504 | License | MIT | Doc PR | - Forgotten when adding the AnonymousFactory in #33503 Commits ------- 0950cfb [SecurityBundle] Don't require a user provider for the anonymous listener
2 parents 9623414 + 0950cfb commit 218eb24

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ private function createAuthenticationListeners(ContainerBuilder $container, stri
464464
throw new InvalidConfigurationException(sprintf('Invalid firewall "%s": user provider "%s" not found.', $id, $firewall[$key]['provider']));
465465
}
466466
$userProvider = $providerIds[$normalizedName];
467-
} elseif ('remember_me' === $key) {
468-
// RememberMeFactory will use the firewall secret when created
467+
} elseif ('remember_me' === $key || 'anonymous' === $key) {
468+
// RememberMeFactory will use the firewall secret when created, AnonymousAuthenticationListener does not load users.
469469
$userProvider = null;
470470
} elseif ($defaultProvider) {
471471
$userProvider = $defaultProvider;

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testMissingProviderForListener()
210210
$container->compile();
211211
}
212212

213-
public function testPerListenerProviderWithRememberMe()
213+
public function testPerListenerProviderWithRememberMeAndAnonymous()
214214
{
215215
$container = $this->getRawContainer();
216216
$container->loadFromExtension('security', [
@@ -223,6 +223,7 @@ public function testPerListenerProviderWithRememberMe()
223223
'default' => [
224224
'form_login' => ['provider' => 'second'],
225225
'remember_me' => ['secret' => 'baz'],
226+
'anonymous' => true,
226227
],
227228
],
228229
]);

0 commit comments

Comments
 (0)
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