Skip to content

use JWT timestamp to validate claims - #181

Open
lutangar wants to merge 2 commits into
TheNetworg:masterfrom
larriereguichet:jwt-timestamp
Open

lutangar wants to merge 2 commits into
TheNetworg:masterfrom
larriereguichet:jwt-timestamp

Conversation

@lutangar

@lutangar lutangar commented Mar 7, 2023

Copy link
Copy Markdown

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

lutangar commented Mar 7, 2023 •

Copy link
Copy Markdown
Author

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

@elernonelma

Copy link
Copy Markdown
Contributor

Yes make sens 👍

@lutangar

lutangar commented Mar 9, 2023 •

Copy link
Copy Markdown
Author

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
Copy Markdown
Author

Ping @hajekj

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