Browse Source

Also set the username in authproxy connector (#3307)

Signed-off-by: Patrick Pacher <patrick.pacher@gmail.com>
pull/3308/head
Patrick Pacher 2 years ago committed by GitHub
parent
commit
8e07edc188
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      connector/authproxy/authproxy.go
  2. 2
      connector/authproxy/authproxy_test.go

1
connector/authproxy/authproxy.go

@ -106,6 +106,7 @@ func (m *callback) HandleCallback(s connector.Scopes, r *http.Request) (connecto
} }
return connector.Identity{ return connector.Identity{
UserID: remoteUserID, UserID: remoteUserID,
Username: remoteUser,
PreferredUsername: remoteUser, PreferredUsername: remoteUser,
Email: remoteUserEmail, Email: remoteUserEmail,
EmailVerified: true, EmailVerified: true,

2
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 // If not specified, the userID and email should fall back to the remote user
expectEquals(t, ident.UserID, testUsername) expectEquals(t, ident.UserID, testUsername)
expectEquals(t, ident.PreferredUsername, testUsername) expectEquals(t, ident.PreferredUsername, testUsername)
expectEquals(t, ident.Username, testUsername)
expectEquals(t, ident.Email, testUsername) expectEquals(t, ident.Email, testUsername)
expectEquals(t, len(ident.Groups), 0) expectEquals(t, len(ident.Groups), 0)
} }
@ -74,6 +75,7 @@ func TestExtraHeaders(t *testing.T) {
expectEquals(t, ident.UserID, testUserID) expectEquals(t, ident.UserID, testUserID)
expectEquals(t, ident.PreferredUsername, testUsername) expectEquals(t, ident.PreferredUsername, testUsername)
expectEquals(t, ident.Username, testUsername)
expectEquals(t, ident.Email, testEmail) expectEquals(t, ident.Email, testEmail)
expectEquals(t, len(ident.Groups), 0) expectEquals(t, len(ident.Groups), 0)
} }

Loading…
Cancel
Save