Skip to content

Instantly share code, notes, and snippets.

@Gompali
Created February 23, 2020 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gompali/0b80f25d38b12eb595a30fb941463f49 to your computer and use it in GitHub Desktop.
Save Gompali/0b80f25d38b12eb595a30fb941463f49 to your computer and use it in GitHub Desktop.
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