Skip to content

Commit

Permalink
Revert "Debug logging for auth provider add/remove"
Browse files Browse the repository at this point in the history
This reverts commit 6a2f424.
  • Loading branch information
jeffputz committed Jul 8, 2024
1 parent 6a2f424 commit 08dec8a
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions src/PopForums.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using PopForums.AzureKit;
Expand All @@ -12,11 +11,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.ResponseCompression;
using System.IO.Compression;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using PopForums.Configuration;

var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
Expand Down Expand Up @@ -88,10 +83,6 @@
services.Configure<BrotliCompressionProviderOptions>(options => options.Level = CompressionLevel.Fastest);


// temporary for https://github.com/dotnet/aspnetcore/discussions/56205
services.RemoveAll<IAuthenticationSchemeProvider>();
services.AddSingleton<IAuthenticationSchemeProvider, LoggingAuthSchemeProvider>();

var app = builder.Build();

if (!app.Environment.IsDevelopment())
Expand Down Expand Up @@ -133,23 +124,4 @@
"default",
"{controller=Home}/{action=Index}/{id?}");

app.Run();


// temporary for https://github.com/dotnet/aspnetcore/discussions/56205

public class LoggingAuthSchemeProvider(IOptions<AuthenticationOptions> options, IErrorLog logger)
: AuthenticationSchemeProvider(options)
{
public override bool TryAddScheme(AuthenticationScheme scheme)
{
logger.Log(null, ErrorSeverity.Information, $"Adding scheme '{scheme.Name}'.");
return base.TryAddScheme(scheme);
}

public override void RemoveScheme(string name)
{
logger.Log(null, ErrorSeverity.Critical, $"Removing scheme '{name}'!!!{Environment.StackTrace}");
base.RemoveScheme(name);
}
}
app.Run();

0 comments on commit 08dec8a

Please sign in to comment.