Skip to content

Instantly share code, notes, and snippets.

@Gompali Gompali/security.yml

Created Feb 23, 2020
Embed
What would you like to do?
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
doctrine:
entity:
class: App\Core\User\Domain\BaseUser
property: username
encoders:
App\Core\User\Domain\BaseUser:
algorithm: auto
cost: 12
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: lazy
guard:
authenticators:
- App\Core\Authentication\Infra\Service\LoginFormAuthenticator
form_login:
csrf_token_generator: security.csrf.token_manager
csrf_token_id: login_string_token
use_referer: true
default_target_path: home
logout:
path: logout
# 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:
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/publication, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
- { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /password, roles: IS_AUTHENTICATED_FULLY }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.