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

feat(JWT): Customised token verification #3695

Merged
merged 8 commits into from
Aug 27, 2024

Conversation

provinzkraut
Copy link
Member

@provinzkraut provinzkraut commented Aug 24, 2024

Customise the automatic verification of JWTs.

  • Config to verify aud
  • Config to verify iss
  • Config to verify iat
  • Config to verify nbf
  • Config for strict aud verification
  • Config for required claims
  • Update ocumentation

JWT backend changes

  • Add accepted_audiences field
  • Add accepted_issuers field
  • Add require_claims field
  • Add verify_expiry field
  • Add verify_not_before field
  • Add strict_audience field

JWT middleware changes

  • Add token_audience` parameter
  • Add token_issuer parameter
  • Add require_claims parameter
  • Add verify_expiry parameter
  • Add verify_not_before parameter
  • Add strict_audience parameter

Token changes

  • Add audience parameter to Token.decode
  • Add issuer parameter to Token.decode
  • Add require_claims parameter to Token.decode
  • Add verify_exp parameter to Token.decode
  • Add verify_nbf parameter to Token.decode
  • Add strict_audience parameter to Token.decode
  • Add decode_payload method

@github-actions github-actions bot added area/docs This PR involves changes to the documentation size: small type/feat pr/internal labels Aug 24, 2024
Copy link

codecov bot commented Aug 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.29%. Comparing base (8cdc43d) to head (496d623).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3695   +/-   ##
=======================================
  Coverage   98.28%   98.29%           
=======================================
  Files         330      330           
  Lines       15041    15118   +77     
  Branches     2394     2401    +7     
=======================================
+ Hits        14783    14860   +77     
  Misses        116      116           
  Partials      142      142           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@provinzkraut provinzkraut force-pushed the jwt/token-verification-customisation branch 3 times, most recently from 23c429e to b1d176d Compare August 26, 2024 18:05
@provinzkraut provinzkraut force-pushed the jwt/token-verification-customisation branch from b1d176d to 1b784d4 Compare August 26, 2024 18:05
@provinzkraut provinzkraut marked this pull request as ready for review August 26, 2024 18:05
@provinzkraut provinzkraut requested review from a team as code owners August 26, 2024 18:05
Copy link

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3695

@provinzkraut provinzkraut enabled auto-merge (squash) August 27, 2024 14:50
@provinzkraut provinzkraut merged commit 44819d0 into main Aug 27, 2024
26 checks passed
@provinzkraut provinzkraut deleted the jwt/token-verification-customisation branch August 27, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs This PR involves changes to the documentation pr/internal size: medium size: small type/feat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants