Skip to content
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

new: Allow to login using LDAP #398

Merged
merged 7 commits into from
Aug 14, 2023
Merged

new: Allow to login using LDAP #398

merged 7 commits into from
Aug 14, 2023

Conversation

marien-probesys
Copy link
Member

@marien-probesys marien-probesys commented Aug 4, 2023

Related issue(s)

#168

Changes

  • add a ldap service to the docker-compose file
  • add the symfony/ldap component and configure it with env vars
  • add a ldapIdentifier to users
  • create and configure a custom authenticator to handle local and ldap auth
  • disallow the edition of profiles managed by LDAP

How to test manually

  • start the dev env with make docker-run LDAP=true
  • login with [email protected] / secret → check it works
  • login with [email protected] / secret → check it does not work
  • login with charlie / secret → check it works
  • check in DB that the user [email protected] does not work
  • login with dominique / secret → check it works and that the user [email protected] now exists in DB
  • go to your profile → check the user is named "Dominique Aragua" but that you can't change your information

Checklist

  • code is manually tested
  • permissions / authorizations are verified
  • interface works on both mobiles and big screens
  • accessibility has been tested
  • tests are up-to-date
  • locales are synchronized
  • copyright notices are up-to-date
  • documentation is up-to-date (including migration notes)

@marien-probesys marien-probesys force-pushed the new/ldap-auth branch 6 times, most recently from c570f9d to 72418b6 Compare August 4, 2023 14:34
The server is configured as an optional service in the Docker Compose
file. It is started by enabling the `ldap` profile. This can be done
with `make docker-start LDAP=true`.

The users are defined in a ldif file placed under `docker/ldap-ldifs/`
which is mounted as a volume in the Docker Compose file. Only Charlie
and Dominique users are defined as the other users will continue to
login as "local" users.

I've enabled `BITNAMI_DEBUG` to help to understand the errors when we
update the ldif file. It's not very verbose anyway.
src/Controller/ProfileController.php Outdated Show resolved Hide resolved
src/Controller/ProfileController.php Outdated Show resolved Hide resolved
src/Security/FormLoginAuthenticator.php Outdated Show resolved Hide resolved
The Authenticator is responsible for verifying user credentials.

Symfony provides several Authenticators, including the “Form Login” that
we already use, and a LDAP variant. Unfortunately, there is no way to
log in from a database or a LDAP directory depending on an attribute
(e.g. auth_type). So we had to write our own Authenticator.
@marien-probesys marien-probesys merged commit 7aca9e5 into main Aug 14, 2023
6 checks passed
@marien-probesys marien-probesys deleted the new/ldap-auth branch August 14, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant