Skip to content

feat(broker): support token_endpoint_headers on credentials#151

Merged
mslipper merged 1 commit into
mainfrom
feat/token-headers-broker
May 25, 2026
Merged

feat(broker): support token_endpoint_headers on credentials#151
mslipper merged 1 commit into
mainfrom
feat/token-headers-broker

Conversation

@mslipper

Copy link
Copy Markdown
Contributor

Mirrors the oauth_token transform's token_endpoint_headers map on the broker so credentials that need a vendor-specific header (e.g. x-api-key) alongside the standard form-body client auth can declare it. Each entry is a discrete secret source resolved per refresh, so a rotated value picks up without restart.

Also fixes a latent bug in both the broker's new refresh path and the oauth_token transport: http.Header.Set was canonicalizing operator-supplied header names ("x-api-key" → "X-Api-Key") even though the existing comment claimed casing was preserved. Both now use direct map assignment so the original casing reaches the wire. The broker carries the wire-level test (raw net.Listen) since httptest's parser canonicalizes on read.

Adds the same token_endpoint_headers map the oauth_token transform
already accepts. Each entry is a discrete secret source whose resolved
value is sent as a request header on the refresh POST, alongside the
standard form-body client auth. Header names reach the wire verbatim:
both the broker's refresh client and the oauth_token transform now use
direct Header map assignment so operator-supplied casing (e.g.
"x-api-key") is not rewritten to "X-Api-Key" by Header.Set.
@mslipper mslipper merged commit be21d37 into main May 25, 2026
7 checks passed
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.

1 participant