Skip to content

Accept explicit token endpoint on /internal/auth/v1/request-access-token#4214

Merged
stevenvegt merged 1 commit into
project-gffrom
add-token-endpoint-to-request-at
Apr 22, 2026
Merged

Accept explicit token endpoint on /internal/auth/v1/request-access-token#4214
stevenvegt merged 1 commit into
project-gffrom
add-token-endpoint-to-request-at

Conversation

@stevenvegt

Copy link
Copy Markdown
Member

Summary

Adds an optional authorization_server_endpoint field to /internal/auth/v1/jwt-grant and /internal/auth/v1/request-access-token. When provided, it is used directly as the JWT aud claim, bypassing the compound-service lookup on the authorizer's DID document.

  • service remains required and still drives the purposeOfUse JWT claim — this only overrides endpoint resolution.
  • No metadata discovery added in the node; the client hands over a final token endpoint URL.
  • Request schemas CreateJwtGrantRequest and RequestAccessTokenRequest are refactored onto a shared JwtGrantBaseRequest via allOf so the new field lives in one place.
  • Existing response field authorization_server_endpoint kept as-is (description clarified, despite the name, it's the RFC 8414 token_endpoint).

Why

Preparing for the FHIR mCSD transition. Clients already perform mCSD lookups for data-access endpoints, so letting them pass the OAuth token endpoint explicitly keeps nuts-node agnostic of the discovery mechanism.

When using mCSD for addressing, the OAuth token endpoint must be
provided to the AT-Request instead of being resolved via a DID-Document.
This commit adds a request param for this.
@qltysh

qltysh Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

1 new issue

Tool Category Rule Count
qlty Structure Function with many returns (count = 7): CreateJwtGrant 1

@stevenvegt
stevenvegt merged commit fa6be1e into project-gf Apr 22, 2026
3 checks passed
@stevenvegt
stevenvegt deleted the add-token-endpoint-to-request-at branch April 22, 2026 15:08
@qltysh

qltysh Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

⬇️ Merging this pull request will decrease total coverage on project-gf by 0.01%.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: B
auth/api/auth/v1/api.go95.0%280
Coverage rating: C Coverage rating: C
auth/services/oauth/relying_party.go100.0%
Total96.4%
🤖 Increase coverage with AI coding...
In the `add-token-endpoint-to-request-at` branch, add test coverage for this new code:

- `auth/api/auth/v1/api.go` -- Line 280

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Comment thread docs/_static/auth/v1.yaml
Comment on lines +524 to +533
authorization_server_endpoint:
type: string
format: uri
description: |
Optional. OAuth token endpoint URL of the authorizer (RFC 8414 `token_endpoint`).
When provided, this URL is used directly as the JWT `aud` claim, bypassing the
compound-service lookup on the authorizer's DID document. `service` remains
required and is still used as the `purposeOfUse` JWT claim. Intended for
clients that discover the endpoint out-of-band (e.g. via FHIR mCSD).
example: https://as.example.nl/ura/12345678/token

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ambiguous, especially when compared to our v2/IAM API;

  • in v2/IAM we have a request field authorization_server, which holds the Authorization Server URL (base URL, so to say), which is NOT the token endpoint. This new endpoint has a postfix _endpoint, so it's inconsistent
  • In this v1 API it's used as Token Endpoint, but it sounds like it's the Authorization Server URL

I suggest to rename it to token_endpoint (or authorizer_token_endpoint to stay in line with the rest of the API)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the problem was already there in the JwtGrantResponse. That field contains exactly this value (as far as I understand correctly). So instead of either renaming that field which would cause a breaking change, use a different name here, which would cause an inconsistency, I opted for fixing it in docs by explicitly explaining this is the RFC 8414 token_endpoint.
Since the authorization_server field in v2 is named differently, I don't see a hard clash.

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