Allow login with prefix of "<domain>\" for selected domains #26686
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some WebDAV clients force to use a domain name for authentication. That domain name is prepended to the username and separated from it using a backslash.
This commit allows any user to login with a prefix of "NC", "NEXTCLOUD" or "WORKGROUP" to their username. The respective prefix is removed from the given username when trying to login if the login failed and also interpreting the given username as an email address failed.
In particular, this can help allowing access to Nextcloud for devices with an interface to SharePoint that forces to specify a domain name for authentication. As an example, HP LaserJet M428/M429 (and many others) can then "Scan to Nextcloud" by using the "Scan to SharePoint" feature (which is essentially WebDav) and configuring a domain name of "NC", "NEXTCLOUD" or "WORKGROUP".
I propose this change since I was unable to find a workaround: There seems to be no way to create user name aliases which would allow me to define "\schlimmchen" as an alias for "schlimmchen". AFAIK even the LDAP integration would not allow login with the format "<username>". Even if I found it acceptable, there is also no way to define a new user with a backslash in its username. And I could not find a way to make the printer not prefix the username by the domain (it forces the user to specify a domain).
But with this patch, one can define "NEXTCLOUD", "NC" or "WORKGROUP" as the domain in the printer/scanner, which will be stripped from the username. It is then possible to use the "Scan to SharePoint" feature to write scanned documents directly into the Nextcloud, which is just beautiful 😉
I am happy to receive feedback on this, maybe even use a completely different solution. Otherwise, this could be a useful feature for other people, too.