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

Explicitly set iat claim of token #1414

Merged
merged 7 commits into from
Apr 22, 2024
Merged

Explicitly set iat claim of token #1414

merged 7 commits into from
Apr 22, 2024

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Apr 16, 2024

Summary

This allows for explicit setting of the iat (Issued At) JWT claim. This allows us to set the issuedAt value of a SIWE message as the iat of the JWT token. Before, the package used for token generation would use "now".

In order to achieve the above, this adds a new issuedAt option to the JwtService['sign'] method, refactoring the jwtClientFactory to isolate connection logic between jsonwebtoken and our JwtService. The niches of the package, e.g. setting the iat inside the payload, not the options now happen in the factory.

Changes

  • Refactor jwtClientFactory to return a "standardised" client.
  • Add an issuesAt option to the JwtService['sign'] method.
  • Add/update associated test coverage.

@coveralls
Copy link

coveralls commented Apr 16, 2024

Pull Request Test Coverage Report for Build 8723040148

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 93.084%

Totals Coverage Status
Change from base Build 8722902980: -0.05%
Covered Lines: 6810
Relevant Lines: 7062

💛 - Coveralls

@iamacook iamacook marked this pull request as ready for review April 16, 2024 13:14
@iamacook iamacook requested a review from a team as a code owner April 16, 2024 13:14
Base automatically changed from cookie-auth to main April 17, 2024 13:35
@iamacook iamacook merged commit 3344184 into main Apr 22, 2024
16 checks passed
@iamacook iamacook deleted the set-iat-claim branch April 22, 2024 14:03
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.

None yet

3 participants