I have an issue with my current projet. I have been using Symfony 2.6 this project is an API called by my front-end. The authentication and log in flow is very specific it uses a middleware (other website).
I add a bundle called JWTAuthenticationWebToken So I need to manually log in user due to the use of a middleware. I installed correctly the bundle and add the right settings but this custom user provider is never called.
How to implements it with the manual login ?
My controller:
<?php $token = new UsernamePasswordToken($user, null, "login", $user->getRoles());
$this->get("security.context")->setToken($token); //now the user is logged in
//now dispatch the login event
$request = $this->get("request");
$event = new InteractiveLoginEvent($request, $token);
$this->get("event_dispatcher")->dispatch("security.interactive_login", $event); ?>
security.yml
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# the login page has to be accessible for everybody
demo_login:
pattern: ^/demo/secured/login$
security: false
login:
pattern: /api/user/uber/f6d75c949cda2517b826cacba5523792
stateless: true
anonymous: true
form_login:
check_path: /api/user/uber/f6d75c949cda2517b826cacba5523792
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
require_previous_session: false
api:
pattern: ^/(api)
stateless: true
lexik_jwt: ~
I also wrote the two files "ApiKeyAuthenticator" and "ApiKeyUserProvider" as mentionned here for manual auth. http://symfony.com/doc/current/cookbook/security/api_key_authentication.html
EDIT : I also created the listeners mentionned in LexikJWTAuthenticationBundle doc'
what's wrong ? :(
Thanks for your help