mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-24 09:18:27 +02:00
Add support for AzureAD authentication for REST admin interface (#637)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NFluent;
|
||||
using System.Linq;
|
||||
using WireMock.Authentication;
|
||||
using WireMock.Logging;
|
||||
using WireMock.Owin;
|
||||
using WireMock.Server;
|
||||
@@ -32,7 +34,23 @@ namespace WireMock.Net.Tests
|
||||
|
||||
// Assert
|
||||
var options = server.GetPrivateFieldValue<IWireMockMiddlewareOptions>("_options");
|
||||
Check.That(options.AuthorizationMatcher).IsNotNull();
|
||||
options.AuthenticationMatcher.Should().NotBeNull().And.BeOfType<BasicAuthenticationMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireMockServer_WireMockServerSettings_StartAdminInterfaceTrue_AzureADAuthenticationIsSet()
|
||||
{
|
||||
// Assign and Act
|
||||
var server = WireMockServer.Start(new WireMockServerSettings
|
||||
{
|
||||
StartAdminInterface = true,
|
||||
AdminAzureADTenant = "t",
|
||||
AdminAzureADAudience = "a"
|
||||
});
|
||||
|
||||
// Assert
|
||||
var options = server.GetPrivateFieldValue<IWireMockMiddlewareOptions>("_options");
|
||||
options.AuthenticationMatcher.Should().NotBeNull().And.BeOfType<AzureADAuthenticationMatcher>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -48,7 +66,7 @@ namespace WireMock.Net.Tests
|
||||
|
||||
// Assert
|
||||
var options = server.GetPrivateFieldValue<IWireMockMiddlewareOptions>("_options");
|
||||
Check.That(options.AuthorizationMatcher).IsNull();
|
||||
Check.That(options.AuthenticationMatcher).IsNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user