Skip to content

Commit 58ca77c

Browse files
committed
Small updates
1 parent da9fb9b commit 58ca77c

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationOptions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ public Func<HttpContext, ProtectedResourceMetadata>? ProtectedResourceMetadataPr
8383
{
8484
get => _resourceMetadataProvider;
8585
set => _resourceMetadataProvider = value;
86-
}
87-
86+
}
8887

8988
/// <summary>
9089
/// Gets the resource metadata for the current request.

src/ModelContextProtocol.Core/Authentication/AuthorizationHelpers.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ internal async Task<ProtectedResourceMetadata> ExtractProtectedResourceMetadata(
144144
}
145145

146146
Uri metadataUri = new(resourceMetadataUrl);
147-
var metadata = await FetchProtectedResourceMetadataAsync(metadataUri, cancellationToken).ConfigureAwait(false);
148-
if (metadata == null)
149-
{
150-
throw new InvalidOperationException($"Failed to fetch resource metadata from {resourceMetadataUrl}");
151-
}
147+
var metadata = await FetchProtectedResourceMetadataAsync(metadataUri, cancellationToken).ConfigureAwait(false)
148+
?? throw new InvalidOperationException($"Failed to fetch resource metadata from {resourceMetadataUrl}");
152149

153150
// Per RFC: The resource value must be identical to the URL that the client used
154151
// to make the request to the resource server

0 commit comments

Comments
 (0)