fix: update JWT authentication

This commit is contained in:
Maël Gangloff
2024-07-18 11:45:46 +02:00
parent 09120c1fb7
commit 9d88599d86
3 changed files with 13 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ lexik_jwt_authentication:
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'
token_ttl: 3600 # in seconds, default is 3600
api_platform:
check_path: /api/login

View File

@@ -13,14 +13,17 @@ security:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/api/login
stateless: true
json_login:
check_path: /api/login
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
api:
pattern: ^/api
stateless: true
entry_point: jwt
json_login:
check_path: /api/login # or, if you have defined a route for your login path, the route name you used
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
jwt: ~
# activate different ways to authenticate
@@ -32,8 +35,9 @@ security:
# 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: ^/api/login, roles: PUBLIC_ACCESS }
- { path: ^/api/login$, roles: PUBLIC_ACCESS }
- { path: ^/api$, roles: PUBLIC_ACCESS }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }

View File

@@ -3,5 +3,6 @@ controllers:
path: ../src/Controller/
namespace: App\Controller
type: attribute
api_login_check:
api_login:
path: /api/login