processing / p5.js-web-editor

The p5.js Editor is a website for creating p5.js sketches, with a focus on making coding accessible and inclusive for artists, designers, educators, beginners, and anyone else! You can create, share, or remix p5.js sketches without needing to download or configure anything.
https://editor.p5js.org
GNU Lesser General Public License v2.1
1.3k stars 1.26k forks source link

Allow using LDAP for user login #3068

Open bojidar-bg opened 3 months ago

bojidar-bg commented 3 months ago

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/user@example.com/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:

welcome[bot] commented 3 months ago

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.