Make the nickname claim conditional on the openid scope too

This is only needed for OIDC anyway
This commit is contained in:
Peter Cai 2023-02-24 16:27:01 +01:00
parent f4be6e135a
commit aec65d8e19
1 changed files with 4 additions and 3 deletions

View File

@ -61,9 +61,10 @@ func UserInfo(ctx *gin.Context) {
if s == "openid" {
userinfoRes["sub"] = *tokenInfo.Sub
} else if s == "username" {
if value, ok := (*userinfo)["username"]; ok {
// Add "nickname" field for OIDC compatibility
userinfoRes["nickname"] = userinfoRes[s]
userinfoRes["nickname"] = value
}
}
}
}