1
1
security :
2
- encoders :
2
+ # a new authentication system is available since Symfony 5.1 to make
3
+ # Symfony security more extensible and easier to understand
4
+ # https://symfony.com/doc/current/security/experimental_authenticators.html
5
+ enable_authenticator_manager : true
6
+
7
+ password_hashers :
3
8
# Our user class and the algorithm we'll use to encode passwords
4
9
# 'auto' means to let Symfony choose the best possible password hasher (Argon2 or Bcrypt)
5
10
# https://symfony.com/doc/current/security.html#c-encoding-passwords
@@ -23,9 +28,6 @@ security:
23
28
# this firewall applies to all URLs
24
29
pattern : ^/
25
30
26
- # but the firewall does not require login on every page
27
- # denying access is done in access_control or in your controllers
28
- anonymous : true
29
31
lazy : true
30
32
31
33
# The user provider to use.
@@ -40,8 +42,8 @@ security:
40
42
# When the user tries to access a protected page, they are redirected here
41
43
login_path : security_login
42
44
# Secure the login form against CSRF
43
- # Reference: https://symfony.com/doc/current/security/csrf.html#csrf-protection-in-login-forms
44
- csrf_token_generator : security.csrf.token_manager
45
+ # Reference: https://symfony.com/doc/current/security/csrf.html
46
+ enable_csrf : true
45
47
# The page users are redirect to when there is no previous page stored in the
46
48
# session (for example when the users access directly to the login page).
47
49
default_target_path : blog_index
@@ -52,6 +54,12 @@ security:
52
54
# The name of the route to redirect to after logging out
53
55
target : homepage
54
56
57
+ # needed because in tests we redefine the 'main' firewall to use
58
+ # HTTP Basic instead of he login form, so this firewall has
59
+ # multiple authenticators
60
+ # See https://symfony.com/doc/current/security/experimental_authenticators.html#configuring-the-authentication-entry-point
61
+ entry_point : ' form_login'
62
+
55
63
# Easy way to control access for large sections of your site
56
64
# Note: Only the *first* access control that matches will be used
57
65
access_control :
@@ -61,3 +69,11 @@ security:
61
69
62
70
role_hierarchy :
63
71
ROLE_ADMIN : ROLE_USER
72
+
73
+ when@test :
74
+ # this configuration simplifies testing URLs protected by the security mechanism
75
+ # See https://symfony.com/doc/current/testing/http_authentication.html
76
+ security :
77
+ firewalls :
78
+ main :
79
+ http_basic : ~
0 commit comments