René's URL Explorer Experiment


Title: BearerTokenAuthMiddleware: Authorization: Bearer should be the default; legacy header should be opt-in alias · Issue #720 · adcontextprotocol/adcp-client-python · GitHub

Open Graph Title: BearerTokenAuthMiddleware: Authorization: Bearer should be the default; legacy header should be opt-in alias · Issue #720 · adcontextprotocol/adcp-client-python

X Title: BearerTokenAuthMiddleware: Authorization: Bearer should be the default; legacy header should be opt-in alias · Issue #720 · adcontextprotocol/adcp-client-python

Description: Summary BearerTokenAuthMiddleware is named after the spec-canonical RFC 6750 Authorization: Bearer header but ships with a single configurable header_name that defaults to "authorization" and accepts no aliases. Adopters with early clien...

Open Graph Description: Summary BearerTokenAuthMiddleware is named after the spec-canonical RFC 6750 Authorization: Bearer header but ships with a single configurable header_name that defaults to "authorization" and accep...

X Description: Summary BearerTokenAuthMiddleware is named after the spec-canonical RFC 6750 Authorization: Bearer header but ships with a single configurable header_name that defaults to "authorization"...

Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/720

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BearerTokenAuthMiddleware: Authorization: Bearer should be the default; legacy header should be opt-in alias","articleBody":"## Summary\n\n``BearerTokenAuthMiddleware`` is named after the spec-canonical RFC 6750 ``Authorization: Bearer`` header but ships with a single configurable ``header_name`` that defaults to ``\"authorization\"`` and accepts no aliases. Adopters with early clients sending tokens via a custom header (``x-adcp-auth``, ``X-Api-Key``, etc.) face a forced binary choice during migration: lock the middleware to the legacy header (breaks every spec-compliant new client, including ``@adcp/sdk`` ``comply()``'s api_key probe path) OR switch to ``Authorization: Bearer`` (breaks every early adopter still on the legacy header).\n\nThe right model is: **``Authorization: Bearer`` is always accepted (the spec-canonical default), legacy aliases are an opt-in additive list.** Both work simultaneously; migration is a one-way drift from legacy clients to spec-compliant ones without flag days.\n\n## Concrete adopter pain (Prebid salesagent)\n\nThe Prebid salesagent ships ``mcp_header_name=\"x-adcp-auth\"`` because early adopters were sending tokens that way before the protocol settled on ``Authorization: Bearer``. Every authenticated MCP call works fine for those clients. But every spec-compliant client — including the SDK's own ``security_baseline`` api_key probe, which sends ``Authorization: Bearer`` per RFC 6750 — gets 401 against the same valid token:\n\n```bash\n$ curl -i -X POST \u003cagent>/mcp \\\n    -H \"Authorization: Bearer \u003cTOKEN>\" \\\n    -H \"Content-Type: application/json\" -d '\u003cjsonrpc body>'\nHTTP/2 401\nwww-authenticate: Bearer\n{\"error\":\"unauthenticated\"}\n\n$ curl -i -X POST \u003cagent>/mcp \\\n    -H \"x-adcp-auth: \u003cTOKEN>\" \\\n    -H \"Content-Type: application/json\" -d '\u003cjsonrpc body>'\nHTTP/2 200\n```\n\nNet consequence: the salesagent fails the ``security_baseline/probe_api_key`` and ``assert_mechanism`` storyboard steps despite having RFC-correct auth — its auth path simply doesn't read the spec header. Filed locally as ``bokelley/salesagent#386`` with a wrapper-middleware workaround that normalizes ``Authorization: Bearer`` → ``x-adcp-auth`` before delegating to ``BearerTokenAuthMiddleware``. Every adopter mid-migration is going to write the same wrapper.\n\n## Proposed API\n\nReplace the singular ``header_name: str`` with a list shape, with ``Authorization: Bearer`` baked in as always-accepted (cannot be turned off — it's the spec, and it's the class's own name).\n\n```python\nclass BearerTokenAuthMiddleware(BaseHTTPMiddleware):\n    def __init__(\n        self,\n        app: Any,\n        *,\n        validate_token: TokenValidator,\n        unauthenticated_response: dict[str, Any] | None = None,\n        # NEW: opt-in additional aliases for legacy clients. The\n        # spec-canonical ``Authorization: Bearer ...`` is ALWAYS\n        # accepted; this is purely additive.\n        legacy_header_aliases: list[str] | None = None,\n        # NEW: bearer_prefix_required applies only to the legacy\n        # aliases (``Authorization`` is RFC 6750 — always requires\n        # the ``Bearer `` prefix).\n        legacy_aliases_bearer_prefix_required: bool = False,\n    ) -> None: ...\n```\n\nPre-request resolution order:\n1. ``Authorization: Bearer \u003ctoken>`` (RFC 6750 §2.1) — always checked first.\n2. Each entry in ``legacy_header_aliases`` in order — first non-empty wins.\n3. Missing / empty → 401.\n\nAdopters with strict requirements can pin a single header by passing ``legacy_header_aliases=None`` (default) — they get spec-canonical only. Adopters migrating clients add ``legacy_header_aliases=[\"x-adcp-auth\"]`` and both paths work simultaneously.\n\n## Backward-compat strategy\n\nThe existing ``header_name`` / ``bearer_prefix_required`` params should be:\n\n1. **Deprecated** with a ``DeprecationWarning`` on construction. Map to the new shape internally — passing ``header_name=\"x-adcp-auth\"`` produces ``legacy_header_aliases=[\"x-adcp-auth\"]`` AND keeps ``Authorization: Bearer`` accepted (this is the **behaviour change**: legacy header config currently EXCLUDES the canonical header; the new shape makes them ADDITIVE).\n\n2. **Removed in the next major** (6.0 / 7.0 depending on release cadence).\n\nThe behaviour change is a strict improvement for every adopter — no one wants to actively reject the spec-canonical header on a middleware named ``BearerTokenAuth``. But it deserves a major-bump entry in the changelog because adopters who relied on header_name acting as an EXCLUSIVE filter (likely zero, but possible) will see ``Authorization: Bearer`` start arriving.\n\n## Why ``WWW-Authenticate: Bearer`` already says so\n\nThe 401 response already advertises ``WWW-Authenticate: Bearer`` (per adcp-client-python#712 once that ships, or already in ``_send_unauthenticated`` for the ASGI path). The middleware is telling buyers \"send me a Bearer token\" while only accepting it on a non-standard header. That's the inconsistency this issue resolves.\n\n## Migration shape for adopters\n\nToday (broken for spec-compliant clients):\n\n```python\nBearerTokenAuth(\n    validate_token=...,\n    mcp_header_name=\"x-adcp-auth\",\n    mcp_bearer_prefix_required=False,\n)\n```\n\nAfter this issue ships (works for both legacy and spec clients):\n\n```python\nBearerTokenAuth(\n    validate_token=...,\n    legacy_header_aliases=[\"x-adcp-auth\"],\n)\n```\n\nAdopters who never had legacy clients (greenfield deployments) drop the kwarg entirely and inherit pure spec compliance.\n\n## Tests\n\nThe upstream test suite for ``BearerTokenAuthMiddleware`` already covers the single-header path. New tests:\n\n- ``Authorization: Bearer X`` accepted by default (no legacy_header_aliases configured)\n- Legacy alias accepted when ``Authorization: Bearer`` absent\n- ``Authorization: Bearer`` wins when both headers present with different tokens (or hand the divergence to a downstream audit hook — same shape as the existing dual-credential audit story).\n- Empty ``Authorization`` value falls through to legacy aliases (not auto-401).\n- Deprecation warning fires on ``header_name=`` construction.\n\n## Severity / urgency\n\nSpec compliance. Not security-critical (the agent still rejects unauthenticated requests correctly via the legacy header path), but every adopter that exposes its endpoint to spec-compliant buyer clients sees gratuitous 401s on calls that carry valid credentials. Compliance probe surfaces it as ``security_baseline/probe_api_key`` failure.\n\n## Related\n\n- adcp-client-python#712 — adjacent ``BearerTokenAuthMiddleware`` defect (``WWW-Authenticate`` header omitted on 401). Same module, same auth path.\n- adcp-client-python#714 — same \"upstream-vs-local workaround\" pattern for ``IdempotencyStore.wrap``.\n- bokelley/salesagent#386 — local workaround (wrapper middleware that normalizes ``Authorization: Bearer`` → ``x-adcp-auth``). Will be deleted when this issue ships.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-13T11:31:41Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/720"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b898fadc-d345-0043-128b-cf9012e8209b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id96DA:65478:C90BEA:10C9449:6B00F976
html-safe-nonce0fe77ee6ececc8e4abcb95dcd2cf65532d6e52944591dbb2320414f723e7d343
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkRBOjY1NDc4OkM5MEJFQToxMEM5NDQ5OjZCMDBGOTc2IiwidmlzaXRvcl9pZCI6IjE3MzA2NDg4MTg3OTEyODMwNjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace97db10ee11ecaae9b657ce5adc43a890da6853b0eec71d1da39e25a00952758
hovercard-subject-tagissue:4437467877
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/720/issue_layout
twitter:imagehttps://opengraph.githubassets.com/86cba4ca9d8793e6fa34f48856f748fa62a11095808e9b861cfd844e1a213e09/adcontextprotocol/adcp-client-python/issues/720
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/86cba4ca9d8793e6fa34f48856f748fa62a11095808e9b861cfd844e1a213e09/adcontextprotocol/adcp-client-python/issues/720
og:image:altSummary BearerTokenAuthMiddleware is named after the spec-canonical RFC 6750 Authorization: Bearer header but ships with a single configurable header_name that defaults to "authorization" and accep...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebokelley
hostnamegithub.com
expected-hostnamegithub.com
Nonee208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187
turbo-cache-controlno-preview
go-importgithub.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git
octolytics-dimension-user_id221690821
octolytics-dimension-user_loginadcontextprotocol
octolytics-dimension-repository_id1090305973
octolytics-dimension-repository_nwoadcontextprotocol/adcp-client-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1090305973
octolytics-dimension-repository_network_root_nwoadcontextprotocol/adcp-client-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7dafd017fb7809a839c443dba08622af38e63c09
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/adcontextprotocol/adcp-client-python/issues/720#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F720
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F720
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=adcontextprotocol%2Fadcp-client-python
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/720
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/720
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/720
adcontextprotocolhttps://github.com/adcontextprotocol
adcp-client-pythonhttps://github.com/adcontextprotocol/adcp-client-python
Codehttps://github.com/adcontextprotocol/adcp-client-python
Issues44 (44)https://github.com/adcontextprotocol/adcp-client-python/issues
Pull requests13 (13)https://github.com/adcontextprotocol/adcp-client-python/pulls
Actionshttps://github.com/adcontextprotocol/adcp-client-python/actions
Projectshttps://github.com/adcontextprotocol/adcp-client-python/projects
Security and qualityhttps://github.com/adcontextprotocol/adcp-client-python/security
Insightshttps://github.com/adcontextprotocol/adcp-client-python/insights
https://github.com/adcontextprotocol/adcp-client-python
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/720
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/720
#721https://github.com/adcontextprotocol/adcp-client-python/pull/721
BearerTokenAuthMiddleware: Authorization: Bearer should be the default; legacy header should be opt-in aliashttps://github.com/adcontextprotocol/adcp-client-python/issues/720#top
#721https://github.com/adcontextprotocol/adcp-client-python/pull/721
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/720#issue-4437467877
feat(auth): accept Authorization: Bearer on MCP leg alongside x-adcp-auth bokelley/salesagent#386https://github.com/bokelley/salesagent/issues/386
Claude Codehttps://claude.com/claude-code
bokelleyhttps://github.com/bokelley
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/720#event-25479428750
fix(server): Authorization: Bearer always accepted; legacy headers ad…https://github.com/adcontextprotocol/adcp-client-python/commit/af68ce0015e6b5b3a6cbf069af6cd292dad119d6
af68ce0https://github.com/adcontextprotocol/adcp-client-python/commit/af68ce0015e6b5b3a6cbf069af6cd292dad119d6
fix(server): Authorization: Bearer always accepted; legacy headers ad…https://github.com/adcontextprotocol/adcp-client-python/commit/dd6503ecf36094d2e00ec042b26ac1f8465f344e
dd6503ehttps://github.com/adcontextprotocol/adcp-client-python/commit/dd6503ecf36094d2e00ec042b26ac1f8465f344e
bokelleyhttps://github.com/bokelley
completedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#721https://github.com/adcontextprotocol/adcp-client-python/pull/721
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/720#event-25479796843
bokelleyhttps://github.com/bokelley
on Oct 3, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/720#event-32417688992
fix(auth)!: unify duplicate credential policy across transports (#1325)https://github.com/adcontextprotocol/adcp-client-python/commit/7f9b6700f0cc41df68374ebe60a3147614c478ea
#1325https://github.com/adcontextprotocol/adcp-client-python/pull/1325
7f9b670https://github.com/adcontextprotocol/adcp-client-python/commit/7f9b6700f0cc41df68374ebe60a3147614c478ea
Sign up for freehttps://github.com/signup?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/720
Sign in to commenthttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/720
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.