// Copyright © WireMock.Net using System.Collections.Concurrent; using System.Security.Cryptography.X509Certificates; using JsonConverter.Abstractions; using JsonConverter.Newtonsoft.Json; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using WireMock.Handlers; using WireMock.Logging; using WireMock.Matchers; using WireMock.Settings; using WireMock.Types; using WireMock.Util; using WireMock.WebSockets; using ClientCertificateMode = Microsoft.AspNetCore.Server.Kestrel.Https.ClientCertificateMode; namespace WireMock.Owin; internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions { public IWireMockLogger Logger { get; set; } = new WireMockConsoleLogger(); public TimeSpan? RequestProcessingDelay { get; set; } public IStringMatcher? AuthenticationMatcher { get; set; } public bool? AllowPartialMapping { get; set; } public ConcurrentDictionary Mappings { get; } = new ConcurrentDictionary(); public IScenarioStateStore ScenarioStateStore { get; set; } = new InMemoryScenarioStateStore(); public ConcurrentObservableCollection LogEntries { get; } = new(); public int? RequestLogExpirationDuration { get; set; } public int? MaxRequestLogCount { get; set; } public Action? PreWireMockMiddlewareInit { get; set; } public Action? PostWireMockMiddlewareInit { get; set; } public Action? AdditionalServiceRegistration { get; set; } public CorsPolicyOptions? CorsPolicyOptions { get; set; } public ClientCertificateMode ClientCertificateMode { get; set; } /// public bool AcceptAnyClientCertificate { get; set; } /// public IFileSystemHandler? FileSystemHandler { get; set; } /// public bool? AllowBodyForAllHttpMethods { get; set; } /// public bool? AllowOnlyDefinedHttpStatusCodeInResponse { get; set; } /// public bool? DisableJsonBodyParsing { get; set; } /// public bool? DisableRequestBodyDecompressing { get; set; } /// public bool? HandleRequestsSynchronously { get; set; } /// public string? X509StoreName { get; set; } /// public string? X509StoreLocation { get; set; } /// public string? X509ThumbprintOrSubjectName { get; set; } /// public string? X509CertificateFilePath { get; set; } /// public X509Certificate2? X509Certificate { get; set; } /// public string? X509CertificatePassword { get; set; } /// public bool CustomCertificateDefined => !string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) || !string.IsNullOrEmpty(X509CertificateFilePath) || X509Certificate != null; /// public bool? SaveUnmatchedRequests { get; set; } /// public bool? DoNotSaveDynamicResponseInLogEntry { get; set; } /// public QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; } /// public bool ProxyAll { get; set; } /// public ActivityTracingOptions? ActivityTracingOptions { get; set; } /// public ConcurrentDictionary WebSocketRegistries { get; } = new(); /// public WebSocketSettings? WebSocketSettings { get; set; } /// public IJsonConverter DefaultJsonSerializer { get; set; } = new NewtonsoftJsonConverter(); }