Output the actual username for test command
Support uses the test command a lot to determine whether the correct public key is being used to authenticate the correct user.
ssh -vT git@gitlab.com
Currently, this displays a welcome message is authentication was successful and an associated user was discovered:
"Welcome to GitLab, #{username}!"
Right now, the username
helper returns the user's actual name.
Welcome to GitLab, Mark Fletcher!
It would be more helpful to display the unique username (e.g. @markglenfletcher
) because there could be multiple accounts with the same actual name. And in the case where a user has multiple accounts and they are using the incorrect key for authentication, it's more than likely that the other account will have an identical name which makes this more difficult to debug.
If the username was returned and displayed it would provide a definitive, unique identifier to determine which account the current, authenticating, public key is associated to.
Example scenario where this would be useful:
- User contacts support when git access is denied stating that the user does not have access to the project
- Support asks for output of the above command to determine the offered public key and the identity of the authenticated user
- Support notices 'Joe Bloggs' was authenticated and searches for a 'Joe Bloggs' in the admin dashboard to check their access to that project is correct
- Multiple 'Joe Bloggs' may be in the system
- If the output returned a username, Support can directly access the account at '/admin/users/:username' and quickly identify the access that the account has
/cc @arihantar @dblessing