Allow remember-me factory creation when multiple user providers are configured.
This commit is contained in:
parent
8dadff2ece
commit
6ab8dd92e9
@ -515,6 +515,9 @@ class SecurityExtension extends Extension
|
||||
throw new InvalidConfigurationException(sprintf('Invalid firewall "%s": user provider "%s" not found.', $id, $firewall[$key]['provider']));
|
||||
}
|
||||
$userProvider = $providerIds[$normalizedName];
|
||||
} elseif ('remember_me' === $key) {
|
||||
// RememberMeFactory will use the firewall secret when created
|
||||
$userProvider = null;
|
||||
} else {
|
||||
$userProvider = $defaultProvider ?: $this->getFirstProvider($id, $key, $providerIds);
|
||||
}
|
||||
|
@ -259,6 +259,28 @@ class SecurityExtensionTest extends TestCase
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testPerListenerProviderWithRememberMe()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->loadFromExtension('security', array(
|
||||
'providers' => array(
|
||||
'first' => array('id' => 'foo'),
|
||||
'second' => array('id' => 'bar'),
|
||||
),
|
||||
|
||||
'firewalls' => array(
|
||||
'default' => array(
|
||||
'form_login' => array('provider' => 'second'),
|
||||
'logout_on_user_change' => true,
|
||||
'remember_me' => array('secret' => 'baz'),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
$container->compile();
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
protected function getRawContainer()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
Reference in New Issue
Block a user