From 8e07edc188222fed79a6db7c8e3e57e6d8e82df7 Mon Sep 17 00:00:00 2001 From: Patrick Pacher Date: Fri, 26 Jan 2024 22:18:08 +0100 Subject: [PATCH] Also set the username in authproxy connector (#3307) Signed-off-by: Patrick Pacher --- connector/authproxy/authproxy.go | 1 + connector/authproxy/authproxy_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/connector/authproxy/authproxy.go b/connector/authproxy/authproxy.go index 7b089818b7..465c3e3d9e 100644 --- a/connector/authproxy/authproxy.go +++ b/connector/authproxy/authproxy.go @@ -106,6 +106,7 @@ func (m *callback) HandleCallback(s connector.Scopes, r *http.Request) (connecto } return connector.Identity{ UserID: remoteUserID, + Username: remoteUser, PreferredUsername: remoteUser, Email: remoteUserEmail, EmailVerified: true, diff --git a/connector/authproxy/authproxy_test.go b/connector/authproxy/authproxy_test.go index 1f234d9a8d..5e09872299 100644 --- a/connector/authproxy/authproxy_test.go +++ b/connector/authproxy/authproxy_test.go @@ -43,6 +43,7 @@ func TestUser(t *testing.T) { // If not specified, the userID and email should fall back to the remote user expectEquals(t, ident.UserID, testUsername) expectEquals(t, ident.PreferredUsername, testUsername) + expectEquals(t, ident.Username, testUsername) expectEquals(t, ident.Email, testUsername) expectEquals(t, len(ident.Groups), 0) } @@ -74,6 +75,7 @@ func TestExtraHeaders(t *testing.T) { expectEquals(t, ident.UserID, testUserID) expectEquals(t, ident.PreferredUsername, testUsername) + expectEquals(t, ident.Username, testUsername) expectEquals(t, ident.Email, testEmail) expectEquals(t, len(ident.Groups), 0) }