Skip to content

JWT issuance and revocation via OIDC for frontend (and JWT backend) #218

Closed

Description

@kilodesodiq-arch

Problem Statement. Today the backend uses static short-lived API keys via the
x-api-key header (api-key.guard.ts). The frontend has no documented way to obtain
short-lived tokens for the user session — everything is "service-to-service." A human user
of the dashboard cannot fully exercise the role hierarchy without resorting to a pre-issued
key.

Why it matters. Without short-lived tokens for users, audit trails collapse into
"which service did this" rather than "which human did this," undermining the JWT-auth
scheme already documented in the OpenAPI.

Technical Context. The Swagger config already declares 'JWT-auth'; the codebase
doesn't actually emit or verify JWTs.

Expected Outcome. Add a Keycloak-friendly OIDC layer: a TokenController
implements /oauth/token, /oauth/userinfo, /oauth/introspect, and /oauth/revoke.
JWTs are signed with an RS256 keypair loaded from env; users and API keys share one
principal model with role claims.

Acceptance Criteria.

  • A new module src/auth-oidc/ provides issuance/verification.
  • Existing ApiKeyGuard continues to accept x-api-key; new routes use @UseGuards(JwtAuthGuard).
  • A revocation list (Redis sorted set keyed by jti) prevents reuse of revoked tokens.
  • E2E test verifies issue / refresh / revoke / introspect flow.

Implementation Notes. Use jose (low dep) and the existing Redis module rather
than rolling key management.

Files or modules likely to be affected. src/auth-oidc/* (new), src/auth/*,
src/common/guards/jwt-auth.guard.ts (new), app.module.ts.

Dependencies. #4 (same Redis), #12 (revocation list).

Difficulty. Hard
Estimated effort. L



Backlog item #10 from `docs/maintainer-issue-backlog.md.

Activity

  1. kimanicode commented on Jul 17, 2026

    @kimanicode
    Contributor

    Hi, I'd like to take this issue. I'll add a new src/auth-oidc/ module implementing /oauth/token, /oauth/userinfo, /oauth/introspect, and /oauth/revoke with RS256 JWTs via jose, a shared principal model with role claims for users and API keys, and a Redis-backed jti revocation list, alongside a new JwtAuthGuard while keeping ApiKeyGuard as is. I'll add an e2e test covering issue, refresh, revoke, and introspect. Please assign it to me, thanks.

  2. grantfox-oss commented on Jul 17, 2026

    @grantfox-oss

    🦊 GrantFox — @kimanicode has been assigned to this issue as part of the Official Campaign | FWC26 campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #218)
    2. Your PR will be reviewed by the ChainForgee maintainers

    Good luck! Track your progress on GrantFox.

  3. grantfox-oss commented on Jul 23, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign | FWC26 campaign!

    @kimanicode's PR #378 was approved and merged by @kilodesodiq-arch.

    🏆 @kimanicode: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (484 total points). Track your full progress on GrantFox.

    👏 Great work, @kimanicode! Keep contributing to ChainForgee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions