Add OAuth 2.1 auth flow and per-request client support for HTTP transport#93
Open
yonglingsong wants to merge 3 commits intoacryldata:mainfrom
Open
Add OAuth 2.1 auth flow and per-request client support for HTTP transport#93yonglingsong wants to merge 3 commits intoacryldata:mainfrom
yonglingsong wants to merge 3 commits intoacryldata:mainfrom
Conversation
0558bc1 to
cf60a95
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
You have used all of your free Bugbot PR reviews. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
DataHubClientcreation from Bearer tokens in HTTP headers, with proper lifecycle management (created per request, closed after)TokenValidatorprotocol for validating/exchanging Bearer tokens before creating DataHub clients (e.g., OIDC validation, token exchange)OIDCTokenValidatorfor OSS deployments using any OIDC-compliant providerBearerTokenDetectionMiddleware(ASGI layer) that returns HTTP 401 withWWW-Authenticateheader to trigger MCP client OAuth flowsDEVELOPING.mdwith step-by-step instructions for running auth flow integration testsKey design decisions
TOKEN_VALIDATOR_FACTORYenv var points to amodule:callablethat returns aTokenValidatorinstance. This keeps vendor-specific auth (Apple Notary, custom JWT exchange) out of thecore server.
MCP_TEST_AUTH_TOKEN/MCP_TEST_AUTH_TOKEN_2— no CLI tool dependencies in the test setup. This keeps test files identical across OSS and internal repos.Note
High Risk
Adds new OAuth 2.1 discovery/proxy endpoints and changes HTTP request authentication to create/validate per-request
DataHubClients, which directly impacts auth enforcement and token handling. Misconfiguration or bugs could lead to unintended 401s, token bypass, or resource leaks under concurrency.Overview
Enables OAuth 2.1 auth discovery and login flows for MCP clients by adding
/.well-known/*metadata plusoauth/*proxy routes that forward authorize/token exchanges to an upstream IdP, including a short-lived in-memory state store.Reworks HTTP auth handling so each request can create a fresh
DataHubClientfrom theAuthorization: Bearerheader (optionally via a pluggableTOKEN_VALIDATOR_FACTORY), falls back to an env-based startup client when available, and closes per-request clients after each call; an ASGIBearerTokenDetectionMiddlewarereturns an HTTP 401 withWWW-Authenticateto trigger client OAuth when OAuth is enabled and no fallback token exists.Adds
httpxdependency, a new genericOIDCTokenValidator, new unit/integration tests covering OAuth endpoints, multi-token concurrency/isolation, and fallback-token behavior, and updatesDEVELOPING.mdwith revised test instructions and required env vars.Written by Cursor Bugbot for commit 708b318. This will update automatically on new commits. Configure here.