mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-20 15:31:20 +02:00
Add support for AzureAD authentication for REST admin interface (#637)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Logging;
|
||||
@@ -19,7 +19,7 @@ namespace WireMock.Owin
|
||||
|
||||
TimeSpan? RequestProcessingDelay { get; set; }
|
||||
|
||||
IStringMatcher AuthorizationMatcher { get; set; }
|
||||
IStringMatcher AuthenticationMatcher { get; set; }
|
||||
|
||||
bool? AllowPartialMapping { get; set; }
|
||||
|
||||
|
||||
@@ -113,10 +113,10 @@ namespace WireMock.Owin
|
||||
|
||||
logRequest = targetMapping.LogMapping;
|
||||
|
||||
if (targetMapping.IsAdminInterface && _options.AuthorizationMatcher != null)
|
||||
if (targetMapping.IsAdminInterface && _options.AuthenticationMatcher != null)
|
||||
{
|
||||
bool present = request.Headers.TryGetValue(HttpKnownHeaderNames.Authorization, out WireMockList<string> authorization);
|
||||
if (!present || _options.AuthorizationMatcher.IsMatch(authorization.ToString()) < MatchScores.Perfect)
|
||||
if (!present || _options.AuthenticationMatcher.IsMatch(authorization.ToString()) < MatchScores.Perfect)
|
||||
{
|
||||
_options.Logger.Error("HttpStatusCode set to 401");
|
||||
response = ResponseMessageBuilder.Create(null, 401);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace WireMock.Owin
|
||||
|
||||
public TimeSpan? RequestProcessingDelay { get; set; }
|
||||
|
||||
public IStringMatcher AuthorizationMatcher { get; set; }
|
||||
public IStringMatcher AuthenticationMatcher { get; set; }
|
||||
|
||||
public bool? AllowPartialMapping { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user