| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
* Remove OAuthProxyMiddleware, ClientRegistrationMiddleware and their interfaces (ADR 0002) * Replace OAuthRequestMetaMiddleware with RequestContext::getAccessToken() * Add ScopePolicy to AuthorizationMiddleware for 403 insufficient_scope step-up * JwtTokenValidator: final, CachedKeySet with refetch on unknown kid, alg allowlist, token type, leeway * ProtectedResourceMetadata: require resource, derive metadata path and challenge URL from it, enforce https * Expose WWW-Authenticate via CORS
| private function escapeHeaderValue(string $value): string | ||
| { | ||
| return str_replace(['\\', '"'], ['\\\\', '\\"'], $value); | ||
| return str_replace(['\\', '"'], ['\\\\', '\\"'], preg_replace('/[\x00-\x1F\x7F]/', '', $value) ?? ''); |
There was a problem hiding this comment.
maybe worth a comment ? (for human readers :p)
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| return array_values(array_unique($required)); |
There was a problem hiding this comment.
I like the readability but not a huge fan of the algorithm's complexity, imo a simple foreach loop with an indexed array would lower the complexity behind $required here. (nit)
Sorry, something went wrong.
| $effective[$scope] = true; | ||
| array_push($pending, ...($this->implies[$scope] ?? [])); | ||
| } | ||
|
|
There was a problem hiding this comment.
interesting algorithm and this one is optimized ^^
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| return array_values(array_unique($scopes)); |
There was a problem hiding this comment.
we already looped onto scopes so we could compute this in the above loop
Sorry, something went wrong.
There was a problem hiding this comment.
Nice refactoring/cleanup!
Sorry, something went wrong.
|
Thanks Chris. The narrowing makes sense to me. I checked SuluMcpBundle and symfony/mcp-bundle against the diff. Neither uses the removed or changed classes. Needs a fix before merge
Smaller points
Question on the token seam RequestContext::getAccessToken() is only filled by the SDK's AuthorizationMiddleware. Both transports read the PSR-7 request attribute AccessToken::class. That is currently a docblock convention. Bundles that authenticate outside the SDK, like Sulu's, need a way to hand over a token. Could you document the attribute as public API? new AccessToken($scopes, $claims) is already public, so that would be enough. Smoke test I'm happy to run a smoke test against the Sulu MCP bundle once this is ready. Ping me when the findings are in. |
Sorry, something went wrong.
Keys without alg are tagged with the token's algorithm instead of the first allowed one.
| Back | FazBrowse Home | New Git URL |
Narrows the auth layer to the resource server role, see ADR 0002 - the proxy and client registration couldn't be hardened without becoming an authorization server, and the 2026-07-28 spec doesn't need them since the metadata points clients at the AS directly.
[BC Break] across Mcp\Server\Transport\Http\OAuth & the auth middleware, see CHANGELOG under 0.9.0.
Checked Drupal's mcp_server/mcp_server_oauth, Sulu's SuluMcpBundle, API Platform, Shopware and symfony/mcp-bundle - none of them uses the removed or changed classes.
Not run against a live Keycloak or Entra yet - the examples need a manual check.
cc @Nyholm @CodeWithKyrian @soyuka WDYT?