collection-crud/config/packages/security.php

37 lines
997 B
PHP
Raw Normal View History

2022-11-17 15:32:57 -05:00
<?php declare(strict_types=1);
2022-11-03 10:44:05 -04:00
2022-11-17 15:32:57 -05:00
use Symfony\Config\SecurityConfig;
2022-11-03 10:44:05 -04:00
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
2022-11-17 15:32:57 -05:00
return static function (ContainerConfigurator $containerConfigurator, SecurityConfig $security): void {
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto')
;
$containerConfigurator->extension('security', [
'providers' => [
'users_in_memory' => [
'memory' => null]
],
'firewalls' => [
'dev' => [
'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
'security' => false
],
'main' => [
'lazy' => true,
'provider' => 'users_in_memory'
]
],
'access_control' => null
]);
2022-11-03 10:44:05 -04:00
if ($containerConfigurator->env() === 'test') {
2022-11-17 15:32:57 -05:00
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, [
'algorithm' => 'auto',
'cost' => 4,
'time_cost' => 3,
'memory_cost' => 10
]);
2022-11-03 10:44:05 -04:00
}
};