Skip to content

Commit 15a50fe

Browse files
Some cleanups for security.yaml (#1395)
1 parent fbc0226 commit 15a50fe

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
security:
2+
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
3+
password_hashers:
4+
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
5+
6+
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
7+
providers:
8+
users_in_memory: { memory: null }
9+
10+
dev:
11+
# Ensure dev tools and static assets are always allowed
12+
pattern: ^/(_profiler|_wdt|assets|build)/
13+
security: false
14+
main:
15+
lazy: true
16+
provider: users_in_memory
17+
18+
# Activate different ways to authenticate:
19+
# https://symfony.com/doc/current/security.html#the-firewall
20+
21+
# https://symfony.com/doc/current/security/impersonating_user.html
22+
# switch_user: true
23+
24+
# Note: Only the *first* matching rule is applied
25+
access_control:
26+
# - { path: ^/admin, roles: ROLE_ADMIN }
27+
# - { path: ^/profile, roles: ROLE_USER }
28+
29+
when@test:
30+
security:
31+
password_hashers:
32+
# Password hashers are resource-intensive by design to ensure security.
33+
# In tests, it's safe to reduce their cost to improve performance.
34+
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
35+
algorithm: auto
36+
cost: 4 # Lowest possible value for bcrypt
37+
time_cost: 3 # Lowest possible value for argon
38+
memory_cost: 10 # Lowest possible value for argon
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_security_logout:
2+
resource: security.route_loader.logout
3+
type: service
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"bundles": {
3+
"Symfony\\Bundle\\SecurityBundle\\SecurityBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"config/": "%CONFIG_DIR%/"
7+
},
8+
"aliases": ["security"],
9+
"conflict": {
10+
"symfony/framework-bundle": "<5.3"
11+
}
12+
}

0 commit comments

Comments
 (0)