Skip to content

feat(secrets): add token_broker source backed by iron-token-broker#143

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

feat(secrets): add token_broker source backed by iron-token-broker#143
mslipper merged 1 commit into
mainfrom
mslipper/token-broker-config

Conversation

@mslipper

Copy link
Copy Markdown
Contributor

Adds a token_broker secrets source so iron-proxy can pull OAuth access tokens from a running iron-token-broker over HTTP. Configure per source with credential_id; broker URL and bearer key come from IRON_BROKER_URL and IRON_BROKER_TOKEN. The fetch closure rejects responses whose remaining lifetime is not greater than the configured cache ttl so stale tokens are never served.

Incidental fix in the broker's HTTP server: explicit net.Listen so the resolved address lands in the "broker HTTP API starting" log line (otherwise :0 configs log addr=":0").

End-to-end coverage in integration_test/token_broker_test.go: boots the real broker binary against an in-process fake OAuth provider, runs requests through the real proxy binary, asserts the upstream sees the broker-issued token and that a second request within the TTL does not trigger another OAuth refresh.

Adds a new secrets.Source type that fetches OAuth access tokens from a
running iron-token-broker over HTTP. Configured per source by
credential_id, with broker URL and bearer key read from IRON_BROKER_URL
and IRON_BROKER_TOKEN. Validates that the broker-reported remaining
lifetime exceeds the configured cache ttl so stale tokens are never
served.

Also fixes the broker HTTP server to explicitly net.Listen and log the
resolved address, so :0 configs no longer log addr=":0" and integration
tests can discover the bound port.
@mslipper mslipper merged commit 5a06a6d into main May 25, 2026
6 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