Token introspection verification & integration tests#4180
Draft
stevenvegt wants to merge 1 commit into4144-4-server-side-flowfrom
Draft
Token introspection verification & integration tests#4180stevenvegt wants to merge 1 commit into4144-4-server-side-flowfrom
stevenvegt wants to merge 1 commit into4144-4-server-side-flowfrom
Conversation
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on 🛟 Help
|
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.

Parent PRD
#4144
Implementation Spec
Overview
Verify that multi-scope tokens work correctly with the existing token introspection endpoints, and add end-to-end integration tests covering the full client→server→introspection flow for all three scope policies.
Key files to modify/create
auth/api/iam/api_test.go— Introspection tests with multi-scope tokensauth/api/iam/s2s_vptoken_test.go— Integration-style testsDesign
Token introspection verification
The existing introspection endpoints (
IntrospectAccessTokenandIntrospectAccessTokenExtended) return thescopefield from the storedAccessToken. SinceAccessToken.Scopeis a string and the OAuth2 spec supports space-delimited scopes, multi-scope tokens should work without code changes.Verify by:
AccessTokenwith a multi-scopeScopefield (e.g.,"urn:nuts:med-overview patient/Observation.read")scopefield in the response contains the full space-delimited stringIf any issues are found (e.g., scope parsing in introspection, field validation against reserved names), fix them in this PR.
Integration tests
Add integration-style tests that exercise the full flow:
Test 1: Profile-only, single scope (backwards compatibility)
scope_policy: "profile-only"(or absent, testing the default)Test 2: Profile-only, multiple scopes (rejection)
invalid_scopeTest 3: Passthrough, multiple scopes
scope_policy: "passthrough"Test 4: Dynamic, PDP approves all
scope_policy: "dynamic"Test 5: Dynamic, PDP partial denial
Test 6: Dynamic, PDP denies credential profile scope
These tests use the existing test infrastructure (
newTestClient, mock dependencies) but exercise the full call chain from scope parsing through token creation to introspection.Testing
This PR is primarily tests. The main deliverable is confidence that:
Acceptance Criteria
IntrospectAccessTokenandIntrospectAccessTokenExtendedhandle multi-scope correctly