Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

use JWT timestamp to validate claims #181

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lutangar
Copy link

@lutangar lutangar commented Mar 7, 2023

This allows better testability.

This feature is better described in the JWT class :

Allow the current timestamp to be specified. Useful for fixing a value within unit testing.
https://github.com/firebase/php-jwt/blob/3b454f90f147db65a615041dec6661f427d6cb00/src/JWT.php#L43-L50

This allows better testability.
This feature is better described in the `JWT` class :

> Allow the current timestamp to be specified. Useful for fixing a value within unit testing.
> https://github.com/firebase/php-jwt/blob/3b454f90f147db65a615041dec6661f427d6cb00/src/JWT.php#L43-L50
@lutangar
Copy link
Author

lutangar commented Mar 7, 2023

Didn't notice at first but #178 is related. I could implement the JWT::$leeway in this one if interested.

@elernonelma
Copy link
Contributor

Yes make sens 👍

@lutangar
Copy link
Author

lutangar commented Mar 9, 2023

Added JWT::$leeway usage in 2b563b8, as seen in #178

This allows time manipulation for testing purpose.
See JWTTest.php#L79-L90 for a usecase.

@lutangar
Copy link
Author

Ping @hajekj

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

Successfully merging this pull request may close these issues.

2 participants