3

I have an old project written in Symfony 3.4 where I used FOSUserBundle for authenticating users.

Recently I started to upgrade the project to Symfony 6 - quite a long journey where I actually created a new project and copied most of the code from the old project.

Now the last challenge is to let existing users authenticate using their current credentials.

Does anyone have an advice on how to tackle this? How can I use the new Symfony authenticate method (with MakerBundle and Security) but for the passwords and hashing algorithm that FOSUserBundle used?

5
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Jan 24, 2023 at 5:31
  • 2
    From a password point of view the only real difference is that encoders was changed to hashers. So you should be able to look in your 3.4 security.yml file, determine the encoding algorithm and parameters and then setup the same for a hasher in 6.x. You will also have to ensure your new User entity implements LegacyPasswordAuthenticatedUserInterface for the salt stuff. Commented Jan 24, 2023 at 15:10
  • You are right @Cerad, if using the same algorithm the login will work. Since I was using bcrypt, no salt was created so I don't need to handle it. Thank you! Commented Jan 24, 2023 at 16:18
  • 1
    Good. Now what you really should do is follow the docs and configure password migrations to a more modern and secure algorithm. Might take a bit to get it working but once configured any password encoded with the old approach will be automatically hashed with the new approach when an user logs in. No further effort needed. Commented Jan 24, 2023 at 17:02
  • Thank you for the advice! First to have the new version up and running in production, and then we'll take care of the password migrations. Commented Jan 25, 2023 at 10:53

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.