mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:53:00 +03:00
[PR #405] [MERGED] feat: implement token introspection #831
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/405
Author: @aksdb
Created: 3/30/2025
Status: ✅ Merged
Merged: 4/9/2025
Merged by: @stonith404
Base:
main← Head:feat/introspection📝 Commits (10+)
ac0bf12feat: implement token introspection2e13c09Merge branch 'main' into feat/introspection410e91efeat: expect API behavior for introspection3a8d122feat: introspect refresh_tokenc3f4fb7use cors middleware, rename token handler1849aafMerge branch 'main' into feat/introspection5fd2dccuse switch statment5c03357docs: fix copy&pasted comment to actually reflect the implementation8fe0008Merge branch 'main' into feat/introspectionc925831fix: use better suited verify method📊 Changes
9 files changed (+416 additions, -14 deletions)
View changed files
📝
backend/internal/controller/oidc_controller.go(+35 -3)📝
backend/internal/controller/well_known_controller.go(+1 -0)📝
backend/internal/dto/oidc_dto.go(+17 -0)📝
backend/internal/middleware/cors.go(+8 -1)📝
backend/internal/service/jwt_service.go(+76 -2)📝
backend/internal/service/jwt_service_test.go(+66 -1)📝
backend/internal/service/oidc_service.go(+89 -0)📝
frontend/tests/data.ts(+34 -2)📝
frontend/tests/oidc.spec.ts(+90 -5)📄 Description
This PR implements the token introspection as requested in ticket #395.
It fulfills RFC 7662 as far as I can tell (at least the client that required it is happy with the result).
The endpoint requires a
client_id/client_secretpair for authentication, so no random attackers can use it to fish for valid tokens (although that attack vector is pretty limited currently, since we don't offer any token revocation anyway). Potentially we could also allow API token auth for this endpoint, but for now it should be a good start with clientid/clientsecret already.It also allows checking for the validity of a
refresh_token.Fixes: https://github.com/pocket-id/pocket-id/issues/395
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.