Skip to content
Snippets Groups Projects
Commit c78bdf14 authored by Pierre Fleutot's avatar Pierre Fleutot
Browse files

Fix firewall pour accès au swagger en tant qu'admin

parent be6ee38a
No related branches found
No related tags found
No related merge requests found
security: security:
enable_authenticator_manager: true enable_authenticator_manager: true
role_hierarchy: role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_OAUTH2_EMAIL] ROLE_ADMIN: [ROLE_USER]
ROLE_SUPER_ADMIN: ROLE_ADMIN ROLE_SUPER_ADMIN: ROLE_ADMIN
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers: password_hashers:
...@@ -19,9 +19,9 @@ security: ...@@ -19,9 +19,9 @@ security:
pattern: ^/api/token$ pattern: ^/api/token$
security: false security: false
api: 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 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 oauth2: true
user_checker: App\Security\EasyUserChecker user_checker: App\Security\EasyUserChecker
...@@ -54,7 +54,6 @@ security: ...@@ -54,7 +54,6 @@ security:
# Note: Only the *first* access control that matches will be used # 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 # Quel que soit le mode d'authentification choisi dans firewalls, on peut contrôler l'accès ici
access_control: 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: ^/verify, roles: PUBLIC_ACCESS }
- { path: ^/register, roles: PUBLIC_ACCESS } - { path: ^/register, roles: PUBLIC_ACCESS }
- { path: ^/reset-password, roles: PUBLIC_ACCESS } - { path: ^/reset-password, roles: PUBLIC_ACCESS }
...@@ -62,8 +61,8 @@ security: ...@@ -62,8 +61,8 @@ security:
- { path: ^/login, role: PUBLIC_ACCESS } - { path: ^/login, role: PUBLIC_ACCESS }
- { path: ^/token, role: PUBLIC_ACCESS } - { path: ^/token, role: PUBLIC_ACCESS }
- { path: ^/.well-known, roles: PUBLIC_ACCESS } - { path: ^/.well-known, roles: PUBLIC_ACCESS }
- { path: ^/api$, role: ROLE_ADMIN } # swagger - { path: ^/api/doc, role: ROLE_ADMIN } # swagger Firewall: main
- { path: ^/api/, roles: [ROLE_OAUTH2_EMAIL, ROLE_ADMIN] } # ajout d'un slash final également dans firewalls > api > pattern - { path: ^/api, roles: [ROLE_OAUTH2_EMAIL] } # Firewall: Api
- { path: ^/, role: ROLE_USER } - { path: ^/, role: ROLE_USER }
when@test: when@test:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment