p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Allow using LDAP for user login

Open bojidar-bg opened this issue 5 months ago • 1 comments

Changes: This PR adds a USE_LDAP environment variable which would replace the email-and-password authentication strategy with an LDAP server (using passport-ldapauth).

I have tested the PR with lldap by modifying the docker-compose-development.yml file to look like:

# ...
services:
  # ...
  lldap:
    image: lldap/lldap:stable
    ports:
    - "17170:17170"
    - "3890:3890"
    environment:
    - LLDAP_LDAP_USER_PASS=test1234
  app:
    # ...
    environment:
      - MONGO_URL=mongodb://mongo:27017/p5js-web-editor
      - LDAP_URL=ldap://lldap:3890
      - USE_LDAP=true

(and subsequently logging into lldap at http://localhost:17170/ as admin/test1234 and creating a new test/testpassword user for the editor (as configured in .env.example) and adding it to the lldap_strict_readonly group, and a user/[email protected]/somepass user for testing the login flow itself)

Currently, this PR does not disable changing one's password once logged in, either in the backend or frontend -- however, since passwords are handled by LDAP, such changes are completely ineffective. Likewise, this PR does not currently disable username+password signups, even though they no longer function when LDAP is enabled. Hence, I have marked it as a "draft" for the moment. Please let me know if you are interested in merging this feature, and I'll try to polish the leftover rough edges (:

I have verified that this pull request:

  • [x] has no linting errors (npm run lint)
  • [X] has no test errors (npm run test)
  • [x] is from a uniquely-named feature branch and is up to date with the develop branch.
  • [ ] is descriptively named and links to an issue number, i.e. Fixes #123 -- does not have an issue, let me know if I should do this.

bojidar-bg avatar Mar 26 '24 06:03 bojidar-bg