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

[FEATURE] Convert LDAP username to valid format #12021

Closed
madmath03 opened this issue Sep 30, 2019 · 0 comments · Fixed by #12461
Closed

[FEATURE] Convert LDAP username to valid format #12021

madmath03 opened this issue Sep 30, 2019 · 0 comments · Fixed by #12461

Comments

@madmath03
Copy link
Contributor

madmath03 commented Sep 30, 2019

Pitch

When enabling LDAP auth, if my LDAP UID is considered invalid by Mastodon (cf. #12020), I would like Mastodon to (at least try to) convert my UID to something valid.

For instance, if my LDAP UID is firstname.lastname, I would like Mastodon to replace invalid chars by an underscore and generate the username firstname_lastname.

This feature could be enabled or disabled with an environment variable:

  • LDAP_UID_CONVERSION_ENABLED=true

We could also add another environment variable to configure the list or regex of characters to replace and maybe the replacement character too:

  • LDAP_UID_CONVERSION_SEARCH=., -
  • LDAP_UID_CONVERSION_REPLACE=_

Motivation

This would help a few people:

  • LDAP admins would not need to create a new entry in users' LDAP info just to store a valid mastodon username
  • LDAP users could easily connect to Mastodon with their same username as any other services
@madmath03 madmath03 changed the title Convert LDAP username to valid format [FEATURE] Convert LDAP username to valid format Sep 30, 2019
madmath03 added a commit to Monogramm/mastodon that referenced this issue Nov 24, 2019
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
Gargron pushed a commit that referenced this issue Dec 1, 2019
* ✨ Convert LDAP username #12021

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>

* 🐛 Fix conversion var use

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>

* 🐛 Fix LDAP uid conversion test

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>

* 👌 Remove comments with ref to PR

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>

* 👌 Remove unnecessary paranthesis

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>

* 🔧 Move space in conversion string

Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
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 a pull request may close this issue.

1 participant