Repository navigation
Open
Milestone
Description
Summary
Introduce first-class JWT signing key rotation support in UltimateAuth while preserving the existing IJwtSigningKeyProvider and IJwtVerificationKeyProvider extension points.
The current built-in implementation supports a single configured HS256 signing key. Although custom providers can supply multiple trusted verification keys, UltimateAuth does not yet provide a managed rotation lifecycle.
Motivation
Replacing the configured JWT signing key currently invalidates previously issued JWTs unless applications supply custom verification key management.
A managed rotation mechanism should allow applications to transition between signing keys without unnecessarily interrupting active authentication.
Proposed Scope
Key management
- Support multiple configured JWT signing keys with unique key IDs (
kid). - Designate exactly one active signing key for new tokens.
- Allow previous keys to remain available for verification.
- Support key states such as active, verification-only, and retired.
- Reject duplicate key IDs, invalid key material, and unsupported algorithms.
Rotation lifecycle
- Introduce a new signing key without immediately removing the previous key.
- Switch new token issuance to the new active key.
- Continue validating existing tokens against trusted verification-only keys.
- Retire previous keys after their issued tokens have expired, accounting for clock skew.
- Support emergency key revocation when a key is compromised.
Provider integration
- Preserve compatibility with
IJwtSigningKeyProvider. - Preserve compatibility with
IJwtVerificationKeyProvider. - Maintain strict
kidmatching. - Never accept signing keys, algorithms, or key URLs supplied by untrusted tokens.
- Keep rotation independent of authentication modes and session persistence.
Configuration and security
- Continue rejecting public development keys outside Development.
- Document secure key storage and deployment practices.
- Ensure key material is never exposed through diagnostics or logs.
- Avoid introducing automatic rotation that depends on persistent storage or external infrastructure by default.
Acceptance Criteria
- New JWTs use the configured active signing key and its
kid. - JWTs signed by verification-only keys remain valid until their normal expiration.
- Retired or revoked keys are rejected.
- Unknown or duplicate key IDs are rejected.
- Key rotation does not disable issuer, audience, lifetime, tenant, or algorithm validation.
- Rotation behavior is covered by unit and integration tests.
- Existing single-key configurations remain compatible.
- Documentation includes an example of performing a safe rotation.
Non-Goals
- Mandatory external KMS integration.
- Automatic scheduled rotation.
- Dynamic retrieval of signing keys from untrusted token metadata.
- Changing token formats or authentication-mode semantics.
- Requiring database persistence for basic JWT validation.
Metadata
Metadata
Assignees
Labels
No labels
Activity