From 6325c0c4b70223c74bed9f7e72e80e862b6cfe8d Mon Sep 17 00:00:00 2001
From: fliaping <xuping19940812@gmail.com>
Date: Fri, 15 Mar 2024 19:29:00 +0800
Subject: [PATCH] add "username" as claim key (#98)

---
 cmd/rdpgw/web/oidc.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/rdpgw/web/oidc.go b/cmd/rdpgw/web/oidc.go
index 8458341..861b3d5 100644
--- a/cmd/rdpgw/web/oidc.go
+++ b/cmd/rdpgw/web/oidc.go
@@ -99,7 +99,7 @@ func (h *OIDC) HandleCallback(w http.ResponseWriter, r *http.Request) {
 }
 
 func findUsernameInClaims(data map[string]interface{}) string {
-	candidates := []string{"preferred_username", "unique_name", "upn"}
+	candidates := []string{"preferred_username", "unique_name", "upn", "username"}
 	for _, claim := range candidates {
 		userName, found := data[claim].(string)
 		if found {
-- 
GitLab