Closed
Description
Symfony version(s) affected
6.3.0
Description
Sometimes during cache:clear there is an error thrown about Symfony\Config\Security\ProviderConfig
missing an entity
method
How to reproduce
This is a tricky part as it is not happening every time but on random occasions.
Possible reproduction:
- have an entity config part in security.php config
- remove var/cache directory
- run bin/console cache:clear
Possible Solution
No response
Additional Context
php: 8.2.7
my config/packages/security.php
:
<?php declare(strict_types = 1);
use App\Constants\Enum\Environment;
use App\Constants\Enum\Role;
use App\Entity\User;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Config\SecurityConfig;
return static function (SecurityConfig $config, ContainerConfigurator $container): void {
$config
->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto');
$config
->provider('user_provider')
->entity()
->class(User::class)
->property('email');
$config
->roleHierarchy(Role::ROLE_ADMIN->value, 'ROLE_ALLOWED_TO_SWITCH');
$config
->accessControl()
->path('^/api/efconnect')
->roles(Role::ROLE_ADMIN->value);
$config
->accessControl()
->path('^/api/elfinder')
->roles(Role::ROLE_ADMIN->value);
$config
->accessControl()
->path('^/glide')
->roles(Role::ROLE_ADMIN->value);
$config
->accessControl()
->path('^/')
->roles(AuthenticatedVoter::PUBLIC_ACCESS);
$config
->firewall(Environment::DEV->value)
->pattern('/(_(wdt|profiler)|css|images|js|map|png|jpe?g|gif|bmp|ico|svg)/')
->security(false)
->lazy(true);
$login = $config
->firewall('login');
$login
->jsonLogin()
->usernamePath('email')
->checkPath('api_users_login');
$login
->pattern('^/');
$login
->logout()
->path('app_users_logout');
$login
->switchUser()
->parameter('X-Switch-User');
if (Environment::TEST->value === $container->env()) {
$config
->passwordHasher(PasswordAuthenticatedUserInterface::class)
->algorithm($algo = 'xxh3')
->hashAlgorithm($algo)
->encodeAsBase64(false)
->iterations(0);
}
};