fix: accept the issuer with or without a trailing slash
Regression introduced with OIDC_ISSUER_MCP. mcpIssuer() stripped the trailing slash — right for building the JWKS URL, wrong for the `iss` claim check, which jose compares by exact string. Authentik emits `.../application/o/shared-memory-mcp/` with the slash, so verification failed with "claim invalid: iss" even though issuer and audience were both correct. Before OIDC_ISSUER_MCP the issuer was passed to jwtVerify unstripped and only stripped when constructing the URL; collapsing both onto the stripped form is what broke it. mcpIssuer() now returns the value as configured, the JWKS URL strips locally, and the claim check accepts both spellings so correctness doesn't hinge on whether someone typed a trailing slash into an env var. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@ export function GET() {
|
||||
// The MCP application's issuer, which is not necessarily the Web UI's —
|
||||
// see mcpIssuer(). Advertising the wrong one sends clients to a discovery
|
||||
// document whose tokens this endpoint will then reject on `iss`.
|
||||
authorization_servers: [mcpIssuer()],
|
||||
authorization_servers: [mcpIssuer()], // as configured, slash and all
|
||||
scopes_supported: ["openid", "profile", "email", audienceScope],
|
||||
bearer_methods_supported: ["header"],
|
||||
resource_documentation: `${resource}/`,
|
||||
|
||||
Reference in New Issue
Block a user