FOSUserBundle and LDAP user before login - Symfony2

709 views Asked by At

I have successfully set up the FOSUserBundle and the FR3D LDAP bundle to allow my company users to login to the web app with their own login.

From now, if someone logins, they will have the default role, which is ROLE_USER. However, I only want a specific role to be allowed (in this case it's ROLE_CONSULT, which I created).

What I am doing to allow users at this moment is:

  1. Ask the user to login to the web app

  2. They get the "You have no right to access this web page"

  3. They tell me he connected

  4. I change the user's role to "ROLE_CONSULT" with a form I created within the admin panel.

What I want to do is:

  1. I select the user from the LDAP list

  2. Change the user role (which is not on the database yet, but will be as soon as I change the role)

  3. The user logins successfully

I already developed the 1 and 2 points, but as the "salt" is empty on the database, it doesn't allow the user to connect as it must believe the password isn't correct.

Any idea how I can make it work by telling Symfony2 it is the first login, it will automatically ONLY check the entered password at my LDAP configuration ?

Thanks.

1

There are 1 answers

1
Anthony On

Alright, that was easy.

I just forgot to put the "DN" to the database. Now it's working.