Add application_type to the Dynamic Client Registration request (#1613)
This commit is contained in:
parent
28806b1b6e
commit
20c464c55b
1 changed files with 223 additions and 3 deletions
|
|
@ -110,6 +110,33 @@ public class AuthTests : OAuthTestBase
|
|||
|
||||
await using var client = await McpClient.CreateAsync(
|
||||
transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal("native", TestOAuthServer.LastApplicationType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DynamicClientRegistration_UsesExplicitApplicationType()
|
||||
{
|
||||
await using var app = await StartMcpServerAsync();
|
||||
|
||||
await using var transport = new HttpClientTransport(new()
|
||||
{
|
||||
Endpoint = new(McpServerUrl),
|
||||
OAuth = new ClientOAuthOptions()
|
||||
{
|
||||
RedirectUri = new Uri("http://localhost:1179/callback"),
|
||||
AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync,
|
||||
DynamicClientRegistration = new()
|
||||
{
|
||||
ApplicationType = "web",
|
||||
},
|
||||
},
|
||||
}, HttpClient, LoggerFactory);
|
||||
|
||||
await using var client = await McpClient.CreateAsync(
|
||||
transport, loggerFactory: LoggerFactory, cancellationToken: TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal("web", TestOAuthServer.LastApplicationType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -124,7 +151,11 @@ public class AuthTests : OAuthTestBase
|
|||
{
|
||||
RedirectUri = new Uri("http://localhost:1179/callback"),
|
||||
AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync,
|
||||
ClientMetadataDocumentUri = new Uri(ClientMetadataDocumentUrl)
|
||||
ClientMetadataDocumentUri = new Uri(ClientMetadataDocumentUrl),
|
||||
DynamicClientRegistration = new()
|
||||
{
|
||||
ApplicationType = "web",
|
||||
},
|
||||
},
|
||||
}, HttpClient, LoggerFactory);
|
||||
|
||||
|
|
@ -258,6 +289,10 @@ public class AuthTests : OAuthTestBase
|
|||
RedirectUri = new Uri("http://localhost:1179/callback"),
|
||||
AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync,
|
||||
ClientMetadataDocumentUri = new Uri("http://invalid-cimd.example.com"),
|
||||
DynamicClientRegistration = new()
|
||||
{
|
||||
ApplicationType = "web",
|
||||
},
|
||||
},
|
||||
}, HttpClient, LoggerFactory);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue