public SerilogUiMiddleware(
     RequestDelegate next,
     IWebHostEnvironment hostingEnv,
     ILoggerFactory loggerFactory,
     UiOptions options,
     ILogger <SerilogUiMiddleware> logger
     )
 {
     _options = options;
     _logger  = logger;
     _staticFileMiddleware  = CreateStaticFileMiddleware(next, hostingEnv, loggerFactory);
     _jsonSerializerOptions = new JsonSerializerSettings
     {
         NullValueHandling = NullValueHandling.Ignore,
         ContractResolver  = new CamelCasePropertyNamesContractResolver(),
         Formatting        = Formatting.None
     };
 }
        public static IApplicationBuilder UseSerilogUi(this IApplicationBuilder applicationBuilder, Action <UiOptions> options = null)
        {
            if (applicationBuilder == null)
            {
                throw new ArgumentNullException(nameof(applicationBuilder));
            }

            var uiOptions = new UiOptions();

            options?.Invoke(uiOptions);

            var scope       = applicationBuilder.ApplicationServices.CreateScope();
            var authOptions = scope.ServiceProvider.GetService <AuthorizationOptions>();

            uiOptions.AuthType = authOptions.AuthenticationType.ToString();

            scope.Dispose();

            return(applicationBuilder.UseMiddleware <SerilogUiMiddleware>(uiOptions));
        }