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

23 lines
686 B
C#
Raw Normal View History

2024-05-20 19:42:04 +02:00
using Foxchat.Identity.Middleware;
2024-05-19 23:51:53 +02:00
namespace Foxchat.Identity.Extensions;
public static class WebApplicationExtensions
{
public static IServiceCollection AddCustomMiddleware(this IServiceCollection services)
{
return services
2024-05-20 19:42:04 +02:00
.AddScoped<ErrorHandlerMiddleware>()
.AddScoped<AuthenticationMiddleware>()
.AddScoped<AuthorizationMiddleware>();
}
2024-05-19 23:51:53 +02:00
public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
{
return app
2024-05-20 19:42:04 +02:00
.UseMiddleware<ErrorHandlerMiddleware>()
2024-05-19 23:51:53 +02:00
.UseMiddleware<AuthenticationMiddleware>()
.UseMiddleware<AuthorizationMiddleware>();
}
}