chill-base-app-v3/config/packages/security.yaml
2024-07-03 12:07:27 +02:00

85 lines
3.9 KiB
YAML

security:
enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
# providers added by chill-bundles recipes
# those providers are required to make chill working
chill_chain_provider:
chain:
providers: [chill_in_memory, chill_users]
chill_in_memory:
memory:
users:
admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH', 'ROLE_USER'] }
chill_users:
id: chill.main.user_provider
# end of providers added by chill-bundles recipes
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# those lines are added by chill-bundles recipe, and are requires to make chill-bundles working
# this firewall is in use for wopi endpoint, which requires
wopi:
pattern: ^/wopi
provider: chill_chain_provider
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
dav:
pattern: ^/dav
provider: chill_chain_provider
stateless: true
guard:
authenticators:
- Chill\DocStoreBundle\Security\Guard\JWTOnDavUrlAuthenticator
# this firewall is the main firewall for chill. It should be the last one in the stack,
# unless you have specific needs
chill_main:
provider: chill_chain_provider
form_login:
csrf_parameter: _csrf_token
csrf_token_id: authenticate
#csrf_provider: security.csrf.token_manager
logout:
path: /logout
switch_user: true
# end of lines added by chill-bundles recipe
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# those lines are added by chill-bundles recipes, and are requires to make chill-bundles working
- { path: ^/(login|logout), roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/wopi, roles: IS_AUTHENTICATED_FULLY }
# access for homepage, the homepage redirect admin to admin section
- { path: ^/$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
- { path: ^/homepage$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# idem
- { path: ^/([a-z]+/)?homepage, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# admin section, only for admin
- { path: ^/([a-z]+/)?admin, roles: ROLE_ADMIN }
# other pages, only for regular user (no admin)
- { path: ^/, roles: ROLE_USER }
# this is the end of line added by chill-project/chill-bundles recipes
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon