When an access token is created, the loginName is taken from the Session
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
https://github.com/nextcloud/server/blob/master/lib/private/legacy/OC_User.php#L194C71-L194C71
This setup was using ldap user backend before. The LDAP user backend set the user ids to the GUID from ldap.
I'm simply providing the GUID from SAML as UID to keep existing users.
As one can see, the Session will be initialized with $uid,$uid. The screenshot shows modified code where I tried to mitigate that problem.
When an access token is created, the loginName is taken from the Session.
Which results in the loginName beeing the UID in case of a SAML setup.
My modified code does not respect or test other setups, which is why I did not issue a pull request.
I'd be very happy about ideas on how to configure / code this properly. I'm guessing maybe a hook from user_saml dependant on propper configuration may be the best approach.
Steps to reproduce
- Configure user_saml
- Generate an app token under personal settings -> security
- See that the login for that token is the user UID
Expected behavior
The Token Login should be a variant of email or other user attribute. The UID is not guaranteed to be anything readable
Installation method
Community Manual installation with Archive
Nextcloud Server version
26
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/private/legacy/OC_User.php around line 194 and apps/settings/lib/Controller/AuthSettingsController.php around line 137, then reproduce the issue with a SAML user by generating an app token under Personal Settings > Security. Trace how the session values become the token loginName. Done means SAML token logins use an appropriate readable user attribute instead of the UID without regressing other user backends.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100