Skip to content

Commit 910a979

Browse files
committed
Disable cert validation in tests because the dev cert may not be trusted
1 parent d747e72 commit 910a979

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/ModelContextProtocol.AspNetCore.Tests/AuthTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public AuthTests(ITestOutputHelper outputHelper)
2525
{
2626
// Let the HandleAuthorizationUrlAsync take a look at the Location header
2727
SocketsHttpHandler.AllowAutoRedirect = false;
28+
// The dev cert may not be installed on the CI, but AddJwtBearer requires an HTTPS backchannel by default.
29+
// The easiest workaround is to disable cert validation for testing purposes.
30+
SocketsHttpHandler.SslOptions.RemoteCertificateValidationCallback = (_, _, _, _) => true;
2831

2932
var oAuthServerProgram = new TestOAuthServer.Program(XunitLoggerProvider, KestrelInMemoryTransport);
3033
_oAuthRunTask = oAuthServerProgram.RunServerAsync(cancellationToken: _testCts.Token);

0 commit comments

Comments
 (0)