I'm using LexikJWTAuthenticationBundle with Api-Platform. I have multiple provider like this :
providers:
app_user_provider:
entity:
class: App\Entity\User
property: email
app_candidat_provider:
entity:
class: App\Entity\Candidat
property: email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
candidat:
pattern: ^/candidat/authentication_token
anonymous: true
lazy: true
stateless: true
provider: app_candidat_provider
json_login:
check_path: /candidat/authentication_token
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
main:
anonymous: true
lazy: true
stateless: true
provider: app_user_provider
json_login:
check_path: /authentication_token
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
It's working when I'm getting the token with candidat firewall 'candidat/authentication_token' but when I'm using the token with authorization header, it's loading the user with main firewall instead of candidat.
How does the bundle know which firewall to use only with a token ?
How to deal with multiple providers ?
Thanks by advance for your help !