collection-crud/config/packages/security.php

37 lines
993 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
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
2023-07-21 10:35:15 -04:00
use Symfony\Config\SecurityConfig;
2022-11-03 10:44:05 -04:00
2022-11-17 15:32:57 -05:00
return static function (ContainerConfigurator $containerConfigurator, SecurityConfig $security): void {
2023-07-21 10:35:15 -04:00
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto');
2022-11-17 15:32:57 -05:00
$containerConfigurator->extension('security', [
'providers' => [
'users_in_memory' => [
2023-07-21 10:35:15 -04:00
'memory' => NULL],
2022-11-17 15:32:57 -05:00
],
'firewalls' => [
'dev' => [
'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
2023-07-21 10:35:15 -04:00
'security' => FALSE,
2022-11-17 15:32:57 -05:00
],
'main' => [
2023-07-21 10:35:15 -04:00
'lazy' => TRUE,
'provider' => 'users_in_memory',
],
2022-11-17 15:32:57 -05:00
],
2023-07-21 10:35:15 -04:00
'access_control' => NULL,
2022-11-17 15:32:57 -05:00
]);
2023-07-21 10:35:15 -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,
2023-07-21 10:35:15 -04:00
'memory_cost' => 10,
2022-11-17 15:32:57 -05:00
]);
2023-07-21 10:35:15 -04:00
}
2022-11-03 10:44:05 -04:00
};