How to preprocess the username in Symfony Security

79 views Asked by At

I am using Symfony Security for the login functionality. My username field is encrypted in the database and I guess that Symfony Security is not able to find the correct user when logging in, because of that.

Currently I have an empty login action, which it says in the docs that I should have:

/**
 * @Route("/login", name="login")
 */
public function loginAction(Request $request)
{
}

I wonder if I could in some way encrypt the username in the request before sending it to Symfonys bundled login method. I guess that I have to extend this loginAction in some way? Or is it just overridden by Symfony?

1

There are 1 answers

0
T. Abdelmalek On

use a custom provider to encrypte $username before you search User entity with username