nuts-foundation / nuts-foundation/nuts-node

Replace experimental jwt-bearer client flag with a grant-types-enabled config

Open
#4,231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth
Dominant language
Go
Stars
28
Forks
23
Avg merge
1d 10h
Merged PRs (30d)
76

Description

Background

PR #4227 added auth.experimental.jwt_bearer_client (bool, default false) to gate the new RFC 7523 jwt-bearer two-VP client flow. During review @reinkrul suggested replacing it with a list-style config so the same mechanism can later enable/disable other grant types (authorization_code, vp_token-bearer, openid4vp, etc.).

We agreed to defer the refactor (rather than do it inside #4227) because doing it properly means touching every grant type that we currently support unconditionally, not just the new one.

Proposed change

Introduce a list-style config:

auth.granttypesenabled: [authorization_code, urn:ietf:params:oauth:grant-type:vp_token-bearer]
  • Default: the grant types we currently support without a flag (authorization_code, vp_token-bearer).
  • Operators opt into the experimental two-VP flow by appending urn:ietf:params:oauth:grant-type:jwt-bearer.
  • Drop auth.Config.Experimental.JwtBearerClient once the new config is in place.

Knock-on: AS metadata advertisement

The same config should drive what the local Authorization Server advertises in its metadata under grant_types_supported. Today the metadata is built from a fixed list; once the config exists, the metadata builder must read from it so AS clients can negotiate correctly.

This is the main reason we deferred the refactor out of #4227: the metadata thread reaches further than the client-side gate, and doing it half-way would hide the change from any peer node fetching our AS metadata.

Scope

  • New config field + flag registration in `auth/cmd` and `auth/config.go`.
  • Replace the `OpenID4VPClient.experimentalJwtBearerClient bool` with a membership check against the enabled set.
  • Wire the same set into `AuthorizationServerMetadata.GrantTypesSupported` construction.
  • Migrate / remove `auth.experimental.jwt_bearer_client`.
  • Update tests, docs (`server_options.rst`), and the release notes.

Related

  • PR #4227 — introduced the boolean flag this issue replaces.
  • PRD #4078 — overall RFC 7523 jwt-bearer client work.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in auth/cmd and auth/config.go to trace registration and loading of the new grant-types-enabled setting, then follow OpenID4VPClient and AuthorizationServerMetadata construction. Update the affected tests, server_options.rst, and release notes; done means the enabled set controls both client behavior and advertised grant_types_supported, with the old flag removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, authentication
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.