fix(oidc): ignore unknown language tag in userinfo unmarshal
Open system reported an issue where a generic OpenID provider might return language tags like "gb". These tags are well-formed but unknown and Go returns an error for it. We already ignored unknown tags is ui_locale arrays lik in AuthRequest. This change ignores singular unknown tags, like used in the userinfo `locale` claim.
This commit is contained in:
parent
6a8e144e8d
commit
bc1fbf5eaa
3 changed files with 55 additions and 12 deletions
|
@ -41,7 +41,13 @@ func (u *UserInfo) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (u *UserInfo) UnmarshalJSON(data []byte) error {
|
||||
return unmarshalJSONMulti(data, (*uiAlias)(u), &u.Claims)
|
||||
if err := unmarshalJSONMulti(data, (*uiAlias)(u), &u.Claims); err != nil {
|
||||
return err
|
||||
}
|
||||
if u.Locale != nil && u.Locale.tag.IsRoot() {
|
||||
u.Locale = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UserInfoProfile struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue