Skip to content

Feature/jwt auth cutover#126

Merged
rustwizard merged 9 commits into
masterfrom
feature/jwt-auth-cutover
Jun 14, 2026
Merged

Feature/jwt auth cutover#126
rustwizard merged 9 commits into
masterfrom
feature/jwt-auth-cutover

Conversation

@rustwizard

Copy link
Copy Markdown
Owner

No description provided.

Replace X-API-Key/X-API-Session with Authorization: Bearer JWT access
tokens plus opaque refresh tokens. /auth and /signup return a token pair;
add /auth/refresh and /auth/logout. Identity comes from JWT claims in all
handlers; ogen errors render in the ErrorResponse shape.
Drop X-API-Key/X-API-Session; the API layer holds the access token and
attaches Authorization: Bearer to every protected request. Auth/signup
store the token pair; add refresh/logout helpers and drop the demo key.
On a 401 the API layer transparently exchanges the refresh token for a new
pair and replays the request once; if refresh fails it clears tokens and
routes back to login via onAuthExpired.
Cover token rotation, replay rejection of a rotated token, unknown-token
401, and that logout revokes the refresh token.
Add a 403 response to move/skip/propose/accept/reject in the spec, a
service.ErrNotParticipant sentinel, and map it to the generated Forbidden
response in handlers (previously a non-participant got 500).
Migration 005 drops users.api_key, now dead after the JWT cutover. Remove
ValidateAPIKey and the APIKey fields/queries from the storage and service
layers.
Document the access/refresh token flow, /auth/refresh and /auth/logout,
the Bearer header, refresh_tokens table and role column; drop api_key and
the x_api_token flag in both README.md and README.ru.md.
@rustwizard rustwizard self-assigned this Jun 13, 2026
Add an implementation-status section, mark done vs pending (rate limiting,
jti blacklist, admin RBAC), and correct deviations: kept /session/ping,
api_key dropped in migration 005, HMAC-hashed refresh tokens, ownership 403
via service.ErrNotParticipant, custom ogen ErrorHandler.
@rustwizard rustwizard merged commit 468f3e7 into master Jun 14, 2026
2 checks passed
@rustwizard rustwizard deleted the feature/jwt-auth-cutover branch June 14, 2026 07:49
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.

1 participant