-
-
Notifications
You must be signed in to change notification settings - Fork 618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to catch entered password for an API call #372
Comments
I found a solution to catch password, i had to edit "create" method for Lexik\Bundle\JWTAuthenticationBundle\Services\JWTManager and add this line ,'password' => $user->getPassword() so my provider now has its password in payloads. `
` And edit the "retrieveUser" method in the class Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider and add this line , ['password' => $token->getCredentials()] ` protected function retrieveUser($username, UsernamePasswordToken $token)
It works fine but the problem is it is not really good to edit inside vendors. So i would like to know how i could override those two methods. |
Hi @maximebourdel, apologies for my late answer. I would suggest to write your own FormLoginAuthenticator, you should find inspiration in https://knpuniversity.com/screencast/guard/login-form.
Putting an hardcoded password in the token payload is not a good idea. |
Hi @chalasr, thank you for the answer, |
Sure, I mean that instead of using the traditional built-in symfony |
Aheum, What I understand is that i will have to create my own logic with form_login but do i have to uninstall lexik ? Another thing i did not said is that my own bundle has its own entities. Thank you in advance. |
hum, it seems KnpUGuardBundle is requiered and it is deprecated since 2.8 and i use 3.2 for my project. |
Hi @chalasr I made a project apart in symfony 2.8 and managed to create my authentication with this exemple. It looks like after checkCredentials method, Do you know how i could replace that call ? Thank you in advance |
Hello,
I installed LexikJWTAuthenticationBundle and everything is ok thank you for the tool
Now I would like to change my provider and make the check from an external API.
the workflow would be the following :
right know i know how to make this but i have to enter the password by myself into the provider class (something like $password = 'mypassword'... )
Do you know how could I get the password entered in the LOGIN form and catch it into my UserProvider implementing UserProviderInterface
or even in my WebserviceUser implementing JWTUserInterface ?
I started with this :
https://symfony.com/doc/current/security/custom_provider.html
Thank you in advance.
Cordially
The text was updated successfully, but these errors were encountered: