2024-05-21 20:14:52 +02:00
|
|
|
using Foxchat.Core.Middleware;
|
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-21 20:14:52 +02:00
|
|
|
.AddScoped<ClientAuthenticationMiddleware>()
|
|
|
|
.AddScoped<ClientAuthorizationMiddleware>();
|
2024-05-20 17:00:21 +02:00
|
|
|
}
|
|
|
|
|
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-21 20:14:52 +02:00
|
|
|
.UseMiddleware<ClientAuthenticationMiddleware>()
|
|
|
|
.UseMiddleware<ClientAuthorizationMiddleware>();
|
2024-05-19 23:51:53 +02:00
|
|
|
}
|
|
|
|
}
|