Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aeb57ab

Browse files
committed
[SecurityBundle] Remove auto picking the first provider
when no provider is explicitly configured on a firewall
1 parent bc4a692 commit aeb57ab

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CHANGELOG
1313
* removed command `acl:set` along with `SetAclCommand` class
1414
* removed command `init:acl` along with `InitAclCommand` class
1515
* removed `acl` configuration key and related services, use symfony/acl-bundle instead
16+
* removed auto picking the first registered provider when no configured provider on a firewall and ambiguous
1617

1718
3.4.0
1819
-----

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
261261
}
262262
$defaultProvider = $providerIds[$normalizedName];
263263
} else {
264+
if (count($providerIds) > 1) {
265+
throw new InvalidConfigurationException(sprintf('Not configuring explicitly the provider on "%s" firewall is ambiguous as there is more than one registered provider.', $id));
266+
}
267+
264268
$defaultProvider = reset($providerIds);
265269

266270
if (count($providerIds) > 1) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ public function testSwitchUserNotStatelessOnStatelessFirewall()
175175
}
176176

177177
/**
178-
* @group legacy
179-
* @expectedDeprecation Firewall "default" has no "provider" set but multiple providers exist. Using the first configured provider (first) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.
178+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
179+
* @expectedExceptionMessage Not configuring explicitly the provider on "default" firewall is ambiguous as there is more than one registered provider.
180180
*/
181181
public function testDeprecationForAmbiguousProvider()
182182
{

0 commit comments

Comments
 (0)