Foxchat.NET/Foxchat.Identity/Extensions/WebApplicationExtensions.cs

20 lines
587 B
C#

using Foxchat.Identity.Authorization;
namespace Foxchat.Identity.Extensions;
public static class WebApplicationExtensions
{
public static IServiceCollection AddCustomMiddleware(this IServiceCollection services)
{
return services
.AddScoped<AuthenticationMiddleware>()
.AddScoped<AuthorizationMiddleware>();
}
public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
{
return app
.UseMiddleware<AuthenticationMiddleware>()
.UseMiddleware<AuthorizationMiddleware>();
}
}