Skip to content
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

Remove issued_at value check #274

Merged
merged 1 commit into from
Jan 9, 2020
Merged

Remove issued_at value check #274

merged 1 commit into from
Jan 9, 2020

Conversation

lbalmaceda
Copy link
Contributor

Changes

The ID Token iat claim value check should be optional.

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. Since this library has unit testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage

  • This change adds integration test coverage

  • This change has been tested on the latest version of the platform/language or why not

Checklist

@lbalmaceda lbalmaceda added this to the v1-Next milestone Jan 9, 2020
@lbalmaceda lbalmaceda requested a review from a team January 9, 2020 17:14
@@ -68,14 +68,6 @@ void verify(@NonNull JWT token, @NonNull IdTokenVerificationOptions verifyOption
throw new TokenValidationException("Issued At (iat) claim must be a number present in the ID token");
}

cal.setTime(token.getIssuedAt());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a single mutable calendar object and then setting it to different values betweet tests seems quite an unusual pattern. Is this normal in Java?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think of Calendar as a "dates calculator". It's easier to do math operations on a Calendar than a Date instance. Note though that once the math is done, an instance of Date is obtained from that Calendar for comparison against another one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get why the Calendar object is being used - it's the re-use for multiple calculations that seems odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've always seen it being used like this, at least for when the min JDK is 7. Calendar is already a heavy object. There's no harm in re-using it and is better than creating multiple instances.

@lbalmaceda lbalmaceda merged commit a50113e into master Jan 9, 2020
@lbalmaceda lbalmaceda deleted the rmv-iat-check branch January 9, 2020 19:59
@lbalmaceda lbalmaceda modified the milestones: v1-Next, 1.20.1 Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants