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
|
|
|
|
{
|
2024-05-20 17:00:21 +02:00
|
|
|
public static IServiceCollection AddCustomMiddleware(this IServiceCollection services)
|
|
|
|
{
|
|
|
|
return services
|
2024-05-20 19:42:04 +02:00
|
|
|
.AddScoped<ErrorHandlerMiddleware>()
|
2024-05-20 17:00:21 +02:00
|
|
|
.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>();
|
|
|
|
}
|
|
|
|
}
|