-
Notifications
You must be signed in to change notification settings - Fork 45
Add numeric username support #179
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
base: main
Are you sure you want to change the base?
Conversation
if username.isnumeric(): | ||
localpart = f"U{username}" | ||
else: | ||
localpart = username |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this implies conflicts if you have both 1234
and U1234
as unique usernames in your system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct. I cannot imagine how to solve this problem at this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial thought would be to add a configuration prefix or something that gets added to all usernames. (Or do something similar to the mapping that the SSO providers do.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can do the trick. Also, I will add one more change to overcome a bug while getting encryption keys. When you try to download backup keys, it asks for the password. Even if you enter it correctly, synapse says it is invallid. This is because the module tries to send the username with the prefix, however there is no match in LDAP for the username with prefix. I had also fixed this problem and will publish another change.
Why not fix the root cause of the problem by prefix all guest account usernames with some reserved string such as "synguest."? I have a significant reason for wanting to use numeric usernames. |
Synapse does not accept numeric usernames since they are reserved for the guest account. If a unique LDAP attribute is chosen while signing in, Synapse returns an error and LDAP module says invalid username or password. This patch handles numeric only usernames by adding an uppercase "U" in the beginning of the numeric username (returned from LDAP uid attribute).
This pull request is related with the issue #55.