feat(auth): implement token revocation and purge mechanism#106
Merged
Conversation
Adds support for individual and client-wide authentication token revocation with state management and audit logging. Includes a new CLI command for database maintenance. API Changes: - DELETE /v1/token: Allows a client to revoke its current bearer token. - DELETE /v1/clients/:id/tokens: Allows an administrator (with delete capability) to revoke all tokens for a specific client. Logic & Persistence: - Updated internal/auth/usecase interfaces (ClientUseCase, TokenUseCase) to include revocation and purge methods. - Added 'revoked_at' column and performance indexes (idx_tokens_expires_at, idx_tokens_revoked_at) to 'tokens' table in PostgreSQL and MySQL. - Implemented transaction-aware revocation and purge logic in repository layer. - Updated authentication middleware to reject revoked tokens. - Added HMAC-signed audit logs for all revocation events. CLI: - Added 'purge-auth-tokens' command to permanently delete expired or revoked tokens older than a specified number of days (default 30). Testing & Quality: - Added comprehensive unit tests for usecases and HTTP handlers using official mocks. - Refactored usecase tests to resolve import cycles. - Updated integration tests to verify end-to-end revocation flows on both databases. - Ensured 100% compliance with 'make lint' and 'make test-all'. Documentation: - Updated CLI reference (docs/cli-commands.md). - Updated OpenAPI specification (docs/openapi.yaml). - Updated Policy Cookbook (docs/auth/policies.md) with revocation personas and examples. - Synchronized project definition (conductor/product.md).
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.
Adds support for individual and client-wide authentication token revocation with state management and audit logging. Includes a new CLI command for database maintenance.
API Changes:
Logic & Persistence:
CLI:
Testing & Quality:
Documentation: