Skip to content

feat: add external token revocation support - #2795

Merged
susilnem merged 7 commits into
developfrom
feature/external-token-revocation
Jul 31, 2026
Merged

feat: add external token revocation support#2795
susilnem merged 7 commits into
developfrom
feature/external-token-revocation

Conversation

@thenav56

@thenav56 thenav56 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Addresses

Depends on

Changes

  • Add is_disabled flag on UserExternalToken as a revocation marker
  • Admin: list/filter + bulk disable/enable actions for tokens
  • Add POST /api/v2/external-token/verify/ endpoint returning
    {"active": bool} for a given jti (active iff not disabled,
    not old, and not expired)
  • Include iat (issued-at) claim in generated tokens

Checklist

Things that should succeed before merging.

  • Updated/ran unit tests
  • Updated CHANGELOG.md

@thenav56
thenav56 marked this pull request as ready for review July 27, 2026 08:58
@thenav56
thenav56 force-pushed the feature/external-token-revocation branch from 5d3b032 to 4c44695 Compare July 28, 2026 13:21
thenav56 and others added 7 commits July 31, 2026 10:42
Enable revoking user external tokens before their natural expiry
(tokens are long-lived, up to 1 year).

- Add is_disabled flag on UserExternalToken as a revocation marker
- Admin: list/filter + bulk disable/enable actions for tokens
- Add POST /api/v2/external-token/verify/ endpoint returning
  {"active": bool} for a given jti (active iff not disabled,
  not old, and not expired)
- Include iat (issued-at) claim in generated tokens
- Tests for the verify endpoint
- Add POST /api/v2/external-token/{id}/revoke/ allowing users to
  revoke their own tokens (scoped via get_queryset; 404 for others,
  400 when already revoked)
- Expose read-only is_disabled on the token serializer; return token
  only on creation via get_token()
- Type the verify endpoint response schema
- Tests for revoke, listing, and get_token behavior
- Regenerate OpenAPI schema (assets submodule)
Return the token id on creation and in the serializer fields so clients
can reference it when revoking a token. Regenerate OpenAPI schema.
treat user, is_old_token as readonly fields
@susilnem
susilnem force-pushed the feature/external-token-revocation branch from 6eca1ed to 2aabdb6 Compare July 31, 2026 05:03
@susilnem
susilnem merged commit 2d9ed0e into develop Jul 31, 2026
3 checks passed
@susilnem
susilnem deleted the feature/external-token-revocation branch July 31, 2026 05:18
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.

2 participants