Skip to content

Commit 59e1841

Browse files
committed
Support incremental scope consent (SEP-835)
- Properly handle path segments in issuer path - Include port in resource comparison
1 parent 66ba342 commit 59e1841

File tree

9 files changed

+550
-291
lines changed

9 files changed

+550
-291
lines changed

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationHandler.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,9 @@ protected override Task HandleChallengeAsync(AuthenticationProperties properties
185185
// Get the absolute URI for the resource metadata
186186
string rawPrmDocumentUri = GetAbsoluteResourceMetadataUri();
187187

188-
properties ??= new AuthenticationProperties();
189-
190-
// Store the resource_metadata in properties in case other handlers need it
191-
properties.Items["resource_metadata"] = rawPrmDocumentUri;
192-
193188
// Add the WWW-Authenticate header with Bearer scheme and resource metadata
194-
string headerValue = $"Bearer realm=\"{Scheme.Name}\", resource_metadata=\"{rawPrmDocumentUri}\"";
189+
string headerValue = $"Bearer resource_metadata=\"{rawPrmDocumentUri}\"";
195190
Response.Headers.Append("WWW-Authenticate", headerValue);
196-
197191
return base.HandleChallengeAsync(properties);
198192
}
199193

src/ModelContextProtocol.AspNetCore/StreamableHttpHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ internal static string MakeNewSessionId()
275275
RandomNumberGenerator.Fill(buffer);
276276
return WebEncoders.Base64UrlEncode(buffer);
277277
}
278+
278279
internal static async Task<JsonRpcMessage?> ReadJsonRpcMessageAsync(HttpContext context)
279280
{
280281
// Implementation for reading a JSON-RPC message from the request body
@@ -291,7 +292,6 @@ internal static string MakeNewSessionId()
291292
return message;
292293
}
293294

294-
295295
internal static Task RunSessionAsync(HttpContext httpContext, McpServer session, CancellationToken requestAborted)
296296
=> session.RunAsync(requestAborted);
297297

src/ModelContextProtocol.Core/Authentication/AuthenticatingMcpHttpClient.cs

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)