diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 4ed5d5ee4084615ea979debb6ffbe7e9e1b7fcfd..0538c9484891aa6afeb62d52335ebb87f5496657 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,7 +1,7 @@ security: enable_authenticator_manager: true role_hierarchy: - ROLE_ADMIN: [ROLE_USER, ROLE_OAUTH2_EMAIL] + ROLE_ADMIN: [ROLE_USER] ROLE_SUPER_ADMIN: ROLE_ADMIN # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: @@ -19,9 +19,9 @@ security: pattern: ^/api/token$ security: false api: - pattern: ^/api/ + pattern: ^/api(?!/doc$) # Accepts routes under /api except /api/doc (pour api/doc, on utilisera donc le firewall "main" ce qui permettra d'accéder au swagger quand on est authentifié via Session PHP avec le role Admin security: true - stateless: true # Pas d'authentification, pas de session utilisateur (mais le compte user est vérifié) + stateless: true # Pas d'authentification, pas de session utilisateur (mais le compte user est vérifié via le token) oauth2: true user_checker: App\Security\EasyUserChecker @@ -54,7 +54,6 @@ security: # Note: Only the *first* access control that matches will be used # Quel que soit le mode d'authentification choisi dans firewalls, on peut contrôler l'accès ici access_control: - - { path: ^/api, roles: PUBLIC_ACCESS } # TODO A RETIRER EN PROD (pour accès Swagger bac à sable) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Puis Utiliser bouton Authorize depuis Swagger - { path: ^/verify, roles: PUBLIC_ACCESS } - { path: ^/register, roles: PUBLIC_ACCESS } - { path: ^/reset-password, roles: PUBLIC_ACCESS } @@ -62,8 +61,8 @@ security: - { path: ^/login, role: PUBLIC_ACCESS } - { path: ^/token, role: PUBLIC_ACCESS } - { path: ^/.well-known, roles: PUBLIC_ACCESS } - - { path: ^/api$, role: ROLE_ADMIN } # swagger - - { path: ^/api/, roles: [ROLE_OAUTH2_EMAIL, ROLE_ADMIN] } # ajout d'un slash final également dans firewalls > api > pattern + - { path: ^/api/doc, role: ROLE_ADMIN } # swagger Firewall: main + - { path: ^/api, roles: [ROLE_OAUTH2_EMAIL] } # Firewall: Api - { path: ^/, role: ROLE_USER } when@test: