Skip to content

Commit e8d0ae8

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [FrameworkBundle][HttpKernel] Add the ability to enable the profiler using a parameter [FrameworkBundle] Trigger deprecations on stderr instead of using trigger_deprecation call Add PhpStanExtractor [Messenger] allow processing messages in batches [Console] Fix backslash escaping in bash completion Add missing validators translation add suggestions for debug:firewall, debug:form, debug:messenger, debug:router [SecurityBundle] Deprecate not configuring explicitly a provider for custom_authenticators when there is more than one registered provider [Inflector] Fix inflector for "zombies" [Config] Add some cache on SelfCheckingResourceChecker fix AJAX request unit spacing fix ErrorExcception in CacheWarmerAggregate Prevent FormLoginAuthenticator from responding to requests that should be handled by JsonLoginAuthenticator Fix wait duration for fixed window policy Add exact command used to trigger invocation to the completion debug log [Translation] correctly handle intl domains with TargetOperation Allow using param as connection atribute in `*.event_subscriber` and `*.event_listener` tags
2 parents 5411756 + cc0f5ad commit e8d0ae8

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ CHANGELOG
3030
* Deprecate the `always_authenticate_before_granting` option
3131
* Display the roles of the logged-in user in the Web Debug Toolbar
3232
* Add the `security.access_decision_manager.strategy_service` option
33+
* Deprecate not configuring explicitly a provider for custom_authenticators when there is more than one registered provider
3334

3435

3536
5.3
@@ -52,6 +53,7 @@ CHANGELOG
5253
* Deprecate the `security.authentication.provider.*` services, use the new authenticator system instead
5354
* Deprecate the `security.authentication.listener.*` services, use the new authenticator system instead
5455
* Deprecate the Guard component integration, use the new authenticator system instead
56+
* Add `form_login.form_only` option
5557

5658
5.2.0
5759
-----

Command/DebugFirewallCommand.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext;
1717
use Symfony\Component\Console\Attribute\AsCommand;
1818
use Symfony\Component\Console\Command\Command;
19+
use Symfony\Component\Console\Completion\CompletionInput;
20+
use Symfony\Component\Console\Completion\CompletionSuggestions;
1921
use Symfony\Component\Console\Input\InputArgument;
2022
use Symfony\Component\Console\Input\InputInterface;
2123
use Symfony\Component\Console\Input\InputOption;
@@ -267,4 +269,11 @@ private function getExampleName(): string
267269

268270
return $name;
269271
}
272+
273+
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
274+
{
275+
if ($input->mustSuggestArgumentValuesFor('name')) {
276+
$suggestions->suggestValues($this->firewallNames);
277+
}
278+
}
270279
}

DependencyInjection/Security/Factory/FormLoginFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct()
3737
$this->addOption('csrf_token_id', 'authenticate');
3838
$this->addOption('enable_csrf', false);
3939
$this->addOption('post_only', true);
40+
$this->addOption('form_only', false);
4041
}
4142

4243
public function getPriority(): int

DependencyInjection/SecurityExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ private function getUserProvider(ContainerBuilder $container, string $id, array
608608
}
609609

610610
if ('remember_me' === $factoryKey || 'anonymous' === $factoryKey || 'custom_authenticators' === $factoryKey) {
611+
if ('custom_authenticators' === $factoryKey) {
612+
trigger_deprecation('symfony/security-bundle', '5.4', 'Not configuring explicitly the provider for the "%s" listener on "%s" firewall is deprecated because it\'s ambiguous as there is more than one registered provider.', $factoryKey, $id);
613+
}
614+
611615
return 'security.user_providers';
612616
}
613617

Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1516
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
1617
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FirewallListenerFactoryInterface;
1718
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
@@ -39,6 +40,8 @@
3940

4041
class SecurityExtensionTest extends TestCase
4142
{
43+
use ExpectDeprecationTrait;
44+
4245
public function testInvalidCheckPath()
4346
{
4447
$this->expectException(InvalidConfigurationException::class);
@@ -314,6 +317,33 @@ public function testDoNotRegisterTheUserProviderAliasWithMultipleProviders()
314317
$this->assertFalse($container->has(UserProviderInterface::class));
315318
}
316319

320+
/**
321+
* @group legacy
322+
*/
323+
public function testFirewallWithNoUserProviderTriggerDeprecation()
324+
{
325+
$container = $this->getRawContainer();
326+
327+
$container->loadFromExtension('security', [
328+
'enable_authenticator_manager' => true,
329+
330+
'providers' => [
331+
'first' => ['id' => 'foo'],
332+
'second' => ['id' => 'foo'],
333+
],
334+
335+
'firewalls' => [
336+
'some_firewall' => [
337+
'custom_authenticator' => 'my_authenticator',
338+
],
339+
],
340+
]);
341+
342+
$this->expectDeprecation('Since symfony/security-bundle 5.4: Not configuring explicitly the provider for the "custom_authenticators" listener on "some_firewall" firewall is deprecated because it\'s ambiguous as there is more than one registered provider.');
343+
344+
$container->compile();
345+
}
346+
317347
/**
318348
* @dataProvider acceptableIpsProvider
319349
*/

0 commit comments

Comments
 (0)