bug #22858 [SecurityBundle] Prevent auto-registration of UserPasswordEncoderCommand (chalasr)
This PR was merged into the 3.3 branch.
Discussion
----------
[SecurityBundle] Prevent auto-registration of UserPasswordEncoderCommand
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22855
| License | MIT
| Doc PR | n/a
Always registers the command as a service even if no encoders are configured so that it is not auto-registered via reflection.
Prevents an irrelevant deprecation when no encoders are configured and, if a day the per-convention command registration is removed, ensures that the command always exists (leading to an exception saying that you have no configured encoder, better than nothing).
ping @ogizanagi
Commits
-------
b39b35b
Prevent auto-registration of UserPasswordEncoderCommand
This commit is contained in:
commit
bca7b41afd
@ -98,11 +98,11 @@ class SecurityExtension extends Extension
|
||||
|
||||
if ($config['encoders']) {
|
||||
$this->createEncoders($config['encoders'], $container);
|
||||
}
|
||||
|
||||
if (class_exists(Application::class)) {
|
||||
$loader->load('console.xml');
|
||||
$container->getDefinition('security.console.user_password_encoder_command')->replaceArgument(1, array_keys($config['encoders']));
|
||||
}
|
||||
if (class_exists(Application::class)) {
|
||||
$loader->load('console.xml');
|
||||
$container->getDefinition('security.console.user_password_encoder_command')->replaceArgument(1, array_keys($config['encoders']));
|
||||
}
|
||||
|
||||
// load ACL
|
||||
|
@ -345,6 +345,11 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
$this->assertEquals('security.user_checker', $this->getContainer('container1')->getAlias('security.user_checker.secure'));
|
||||
}
|
||||
|
||||
public function testUserPasswordEncoderCommandIsRegistered()
|
||||
{
|
||||
$this->assertTrue($this->getContainer('remember_me_options')->has('security.console.user_password_encoder_command'));
|
||||
}
|
||||
|
||||
protected function getContainer($file)
|
||||
{
|
||||
$file = $file.'.'.$this->getFileExtension();
|
||||
|
Reference in New Issue
Block a user