feat(oidc): outbound PKCE + configurable prompt parameter
Summary
Two related additions to the OIDC client side of the proxy, both surfaced by trying to use the proxy against IdPs that follow OAuth 2.1 strictly (in our case Duo SSO and Microsoft Entra ID).
1. Outbound PKCE
OAuth 2.1-compliant IdPs reject /authorize requests that omit
code_challenge + code_challenge_method, even from confidential
clients with a client_secret. Without this patch, configuring such an
IdP fails immediately with errors like:
Must specify both 'code_challenge' and 'code_challenge_method'.
AuthCodeURL now generates a verifier, stores it keyed by state,
and adds the S256 challenge to the redirect. Exchange reads the
verifier back via the same state key and includes it on the token
exchange. Storage is an in-process sync.Map — acceptable because the
proxy already requires sticky sessions for inbound OAuth state. If
running multi-instance behind a load balancer is on the roadmap, the
verifiers could move into the repository abstraction.
2. --oidc-prompt / OIDC_PROMPT
Sends the value as the OIDC prompt query parameter on the upstream
/authorize call. Empty (default) preserves current behavior.
Concrete reason this is useful: with Microsoft Entra ID, an existing
browser session silently SSOs through the redirect without ever showing
the IdP's login screen — making it hard to verify operationally whether
MFA actually fires (it did, on the original session, but it's invisible).
OIDC_PROMPT=login forces Entra to render the login page on every
pairing; consent / select_account / none are also accepted
per OIDC Core 1.0 § 3.1.2.1.
Test plan
- [x] Confirmed against Duo SSO MCP OAuth Server: without the PKCE
patch,
/authorizereturns the "Must specify code_challenge" error; with the patch, the flow completes. - [x] Confirmed against Microsoft Entra ID: without
OIDC_PROMPT, silent SSO bypasses the login screen; withOIDC_PROMPT=login, Entra renders the login page on every pairing. - [x] No regression on inbound (claude.ai → proxy) flow.
- [ ] No tests touched — let me know if you'd like coverage extending
oidc_test.gofor the new fields and I'll happily add it.
Compatibility
- Existing deployments with no
OIDC_PROMPTset: no behavior change. - Existing deployments against IdPs that don't require PKCE (e.g. Okta,
Auth0 with default config): no behavior change beyond a (harmless)
extra
code_challengeon the wire, which they'll accept.
Happy to split this into two PRs if that's preferable — they're functionally independent. Kept together because they're both very small and were debugged in the same session.
doc-check has already been removed, so the failure can be ignored.