Skip to content

Fixing bug in iat validation when enabled #443

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

Closed
wants to merge 1 commit into from

Conversation

the-wagness
Copy link

I was using parser options to set WithIssuedAt() in my application code, and noticed my unit test unexpectedly did not fail when my test JWTs omitted this field.

Upon inspecting the code, I found Validate() seemed to pass v.verifyIssuedAt the value false for the required argument, which effectively ignores validation for this field when its explicitly configured via WithIssuedAt().

Further, I added a testcase to the validator_test.go unit tests, and found that my unit test was not failing when I changed back to the old code. Upon inspection, I found that an errant if statement was only testing if the error messages matched if there was an error at all, which will not test if there is not an error even when one is expected.

@the-wagness
Copy link
Author

Closing this PR as I have found this behavior is intentional per: #411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant