Skip to content

Add RSA to JWT API and Generic Enforced Claims#269

Open
erikburt wants to merge 18 commits intoobelisk:mainfrom
erikburt:feat/issue-jwt-rs256-support
Open

Add RSA to JWT API and Generic Enforced Claims#269
erikburt wants to merge 18 commits intoobelisk:mainfrom
erikburt:feat/issue-jwt-rs256-support

Conversation

@erikburt
Copy link

@erikburt erikburt commented Feb 17, 2026

This PR accomplishes 2 things.

  • adds support for different JWT key types (RSA for now), as the original implementation solely supported ECDSA256.
    • Breaking: Adds mandatory key_type field to a key's config
  • Breaking: adds enforced_claims to JwtConfig, and removes enforced_aud
    • This makes the enforceable claims more generic, and not limited solely to aud.

Changes

  • Add key type enum, necessary for deserialization and choosing an appropirate algorithm
  • Add a JwtConfigRaw for initial deserialization.
    • This ensures we have a struct without jsonwebtoken::EncodingKey parameter, which is not easily deserialized to directly when there's multiple possible key types.
      • previous implementation blindly used EncodingKey::from_ec_pem
    • So now we deserialize to the JwtConfigRaw struct, and then map that to the slightl modified JwtConfig struct.
  • Adds enforced_claims, replacing more specific enforced_aud functionality
  • Adds tests for RSA keys + enforced_claims functionality
    • Made test request bodies more descriptive, so you can more easily figure out which test is failing.

Testing

Ran the tests locally, and are passing.

Breaking Changes

  1. JwtConfig now requires mandatory key_type - possible values are es256, and rs256.
  2. enforced_aud has been removed from the JwtConfig. You must now use enforced_claims.aud instead
    • if JwtParams includes aud, and it doesn't match the key's enforced_claims.aud (if present), then it will throw an error
    • Previous behaviour was using enforced_aud if it was set, and ignoring JwtParams.aud (ie. no error)

@erikburt erikburt marked this pull request as ready for review February 17, 2026 23:08
Copy link
Owner

@obelisk obelisk left a comment

Choose a reason for hiding this comment

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

Looks right. Needs a test added to test_jwt though

@erikburt erikburt changed the title feat: support rs256 in jwt signing [BREAKING] feat: jwt - support rsa keys and generic enforced claims Feb 18, 2026
@erikburt erikburt requested a review from obelisk February 18, 2026 21:58
@erikburt erikburt changed the title [BREAKING] feat: jwt - support rsa keys and generic enforced claims [BREAKING] feat: jwt - rsa keys and generic enforced claims Feb 18, 2026
@erikburt
Copy link
Author

I can split this into 2 PRs if preferred.

@obelisk obelisk added enhancement New feature or request API Relating to the API subsystems breaking For changes that break existing configurations or modules where recompilation will not fix it labels Feb 19, 2026
@obelisk obelisk changed the title [BREAKING] feat: jwt - rsa keys and generic enforced claims Add RSA to JWT API and Generica Enforced Claims Feb 19, 2026
@obelisk obelisk changed the title Add RSA to JWT API and Generica Enforced Claims Add RSA to JWT API and Generic Enforced Claims Feb 19, 2026
I added JWT validation to the tests, however jsonwebtoken dependency
expects a JS runtime when compiled to WASM. This causes errors when
trying to call it from an LLVM/cranelift env.
@erikburt erikburt force-pushed the feat/issue-jwt-rs256-support branch from 19164bb to 1e5b37c Compare February 21, 2026 00:33
@obelisk obelisk requested a review from michelemin February 25, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Relating to the API subsystems breaking For changes that break existing configurations or modules where recompilation will not fix it enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants