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

View file

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