This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
pflaenz.li-Symfony/config/packages/security.yaml

53 lines
2.1 KiB
YAML
Raw Normal View History

2021-04-22 14:42:22 +02:00
security:
enable_authenticator_manager: true
password_hashers:
# use your user class name here
2021-04-22 14:51:34 +02:00
App\Entity\User:
# Use native password hasher, which auto-selects the best
# possible hashing algorithm (starting from Symfony 5.3 this is "bcrypt")
2021-04-22 14:51:34 +02:00
algorithm: auto
2021-04-22 14:42:22 +02:00
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
2021-04-22 14:51:34 +02:00
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: email
2021-04-22 14:42:22 +02:00
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
2021-04-22 14:51:34 +02:00
provider: app_user_provider
2021-09-14 14:03:27 +02:00
custom_authenticators:
- App\Security\AppAuthenticator
2021-04-22 15:20:02 +02:00
logout:
path: app_logout
# where to redirect after logout
# target: app_any_route
2021-05-20 23:34:50 +02:00
remember_me:
secret: '%kernel.secret%'
lifetime: 604800 # 1 week in seconds
path: /
secure: true
samesite: strict
# by default, the feature is enabled by checking a
# checkbox in the login form (see below), uncomment the
# following line to always enable it.
#always_remember_me: true
2021-04-22 14:42:22 +02:00
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
2021-05-09 17:52:08 +02:00
- { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
2021-04-30 21:24:51 +02:00
- { path: ^/admin, roles: ROLE_ADMIN }
2022-01-19 16:22:40 +01:00
- { path: ^(?!/(login|register|reset-password|offers|offer/*|imprint|faq|sitemap.*)), roles: ROLE_USER }