-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix(auth): fail gracefully when no cache headers are available #623
Conversation
auth/token_verifier.go
Outdated
@@ -476,19 +473,20 @@ func parsePublicKey(kid string, key []byte) (*publicKey, error) { | |||
return &publicKey{kid, pk}, nil | |||
} | |||
|
|||
func findMaxAge(resp *http.Response) (*time.Duration, error) { | |||
func findMaxAge(resp *http.Response) *time.Duration { | |||
duration := time.Duration(0) * time.Second |
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.
Can this line go with the default return value at the bottom of the function?
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.
Thanks! Moved the default value to the bottom
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.
LGTM
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.
LGTM. Thank you so much for the quick response Lahiru!
qq - r we able to test this against a real response?
Yeah, the integrations tests are all green! |
Resolves: #621
Avoid throwing errors when parsing cache control headers for public keys and set the cache duration to 0 (equivalent to no cache) when the cache headers cannot be parsed.