-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various cherry picks from v2 onto v3 #286
Conversation
Using mime.ParseMediaType
… instead of a bool
this fix one word typo of the IDTokenVerifier.Verify function's comment Fixes coreos#265
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spot checked for anything that looked breaking. LGTM.
oidc/oidc.go
Outdated
func (sb *stringAsBool) UnmarshalJSON(b []byte) error { | ||
var result bool | ||
err := json.Unmarshal(b, &result) | ||
if err == nil { | ||
*sb = stringAsBool(result) | ||
return nil | ||
} | ||
var s string | ||
err = json.Unmarshal(b, &s) | ||
if err != nil { | ||
return err | ||
} | ||
result, err = strconv.ParseBool(s) | ||
if err != nil { | ||
return err | ||
} | ||
*sb = stringAsBool(result) | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be simpler:
func (sb *stringAsBool) UnmarshalJSON(b []byte) error {
switch string(b) {
case "true", `"true"`:
*sb = stringAsBool(true)
case "false", `"false"`:
*sb = stringAsBool(false)
default:
return errors.New("wat")
}
return nil
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Added as a separate commit to preserve commit history.
Includes #266, #261, #255, #254