refactor: consolidate jwt into TokenService - #36
Merged
Conversation
All four token kinds mint and validate through one application service with typed SignedToken<K>/TypedClaims<K> wrappers, so a wrong-kind token is a compile error. Replaces the SecretAware seam with TokenServiceAware ahead of the asymmetric key migration (ROC-158). Drops the dead session_id claim. Tests use a shared helper instead of hand-forged jsonwebtoken calls.
Acceptance matrix now gates PRs; dist-cache is skipped for pull_request events so unreviewed code cannot overwrite the shared test-latest image, and perf/zap/publish skip transitively via needs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 0 of the modularization plan. Prerequisite for the asymmetric key migration (ROC-158).
TokenServicein the application layer, with per-kind TTLs from existing config.SignedToken<K>/TypedClaims<K>— using a token of the wrong kind is now a compile error; the kind claim is checked once at decode.SecretAwarereplaced withTokenServiceAware: call sites no longer know a secret string exists, only a service that signs and validates. This is the seam ROC-158 swaps for a keystore.session_idclaim removed (alwaysNonesince session removal).tests/utils/jwt.rs) instead of hand-forgedjsonwebtokencalls with the literal"secret".Behavior and token wire format unchanged —
token_typeclaim stays in the JSON payload; HTTP responses byte-identical.Test plan
jsonwebtokenimports verified confined to the token module (grep clean).