8000 [Security] Make remember-me user providers lazy by chalasr · Pull Request #34739 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Make remember-me user providers lazy #34739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Security} Make remember-me user providers lazy
  • Loading branch information
Robin Chalas committed Dec 4, 2019
commit bea74560e1942dbe6146df1b81fcc85c0bb20614
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory;

use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -104,7 +105,7 @@ public function create(ContainerBuilder $container, string $id, array $config, ?
throw new \RuntimeException('You must configure at least one remember-me aware listener (such as form-login) for each firewall that has remember-me enabled.');
}

$rememberMeServices->replaceArgument(0, array_unique($userProviders));
$rememberMeServices->replaceArgument(0, new IteratorArgument(array_unique($userProviders)));

// remember-me listener
$listenerId = 'security.authentication.listener.rememberme.'.$id;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/SecurityBundle/composer.json
CA7F
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"symfony/security-core": "^4.4|^5.0",
"symfony/security-csrf": "^4.4|^5.0",
"symfony/security-guard": "^4.4|^5.0",
"symfony/security-http": "^4.4.1|^5.0.1"
"symfony/security-http": "^5.1"
},
"require-dev": {
"doctrine/doctrine-bundle": "^1.5|^2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
/**
* @throws \InvalidArgumentException
*/
public function __construct(array $userProviders, string $secret, string $providerKey, array $options = [], LoggerInterface $logger = null)
public function __construct(iterable $userProviders, string $secret, string $providerKey, array $options = [], LoggerInterface $logger = null)
{
if (empty($secret)) {
throw new \InvalidArgumentException('$secret must not be empty.');
}
if (empty($providerKey)) {
throw new \InvalidArgumentException('$providerKey must not be empty.');
}
if (!\is_array($userProviders) && !$userProviders instanceof \Countable) {
$userProviders = iterator_to_array($userProviders, false);
}
if (0 === \count($userProviders)) {
throw new \InvalidArgumentException('You must provide at least one user provider.');
}
Expand Down
0