Skip to content

Conversation

frankdekker
Copy link
Contributor

@frankdekker frankdekker commented Feb 25, 2025

When a jwt token is created on one server and then used on another, there might be a slight time difference in the jwt token timestamp. However the jwt validation is by default set to PT0S leeway and rejects the jwt token.

The league/oauth2-server uses lcobucci/jwt for jwt creation and validation. There's an option to set the jwt leeway. See
the constructor of https://github.com/thephpleague/oauth2-server/blob/master/src/AuthorizationValidators/BearerTokenValidator.php

However there is no way to set this value via the oauth2-server-bundle. This PR allows to set this value.

@frankdekker frankdekker changed the title Add jwt leeway configuration option feat: Add jwt leeway configuration option Feb 25, 2025
@frankdekker frankdekker marked this pull request as ready for review February 25, 2025 21:21
@chalasr
Copy link
Member

chalasr commented Mar 3, 2025

👍 for this, though the failing test seems related isn't it? Can you please have a look?
I'd like to tag v1.0 stable after merging this one. /cc @ro0NL

@chalasr
Copy link
Member

chalasr commented Mar 3, 2025

Failure is not related actually. I'm going to have a look asap, help welcome.

@chalasr
Copy link
Member

chalasr commented Mar 3, 2025

Failure fixed, rebase needed :)

@frankdekker
Copy link
Contributor Author

Failure fixed, rebase needed :)

Hey, thanks for the test fix. It seems to have improved a lot but not all the way. Looking at your PR for the fix, that's also not green yet.

@chalasr
Copy link
Member

chalasr commented Mar 11, 2025

Remaining failures need some work to go away, not right now :) Can you add a test case for this?

@frankdekker
Copy link
Contributor Author

Remaining failures need some work to go away, not right now :) Can you add a test case for this?

Added an acceptance test.

I had a bit of struggles with the cache in /tests/.kernel. Changing the TestKernel configuration was ignored by the existing cache. I added separate cache directories for when TestKernel configuration is given. Let me know if you agree with this approach, or you have another suggestion :).

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

Nice 👍

@chalasr
Copy link
Member

chalasr commented Mar 22, 2025

@frankdekker Already suffered from this as well, we should do something to improve the situation. All good here

@chalasr chalasr force-pushed the Add-support-for-jwt-leeway-interval-configuration branch from 0c8a1c1 to c84131b Compare March 22, 2025 15:41
@chalasr
Copy link
Member

chalasr commented Mar 22, 2025

Thank you @frankdekker.

@chalasr chalasr merged commit 74344b0 into thephpleague:master Mar 22, 2025
22 of 25 checks passed
@frankdekker frankdekker deleted the Add-support-for-jwt-leeway-interval-configuration branch September 24, 2025 07:50
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.

2 participants