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

23 lines
741 B
C#

using Foxchat.Core.Middleware;
using Foxchat.Identity.Middleware;
namespace Foxchat.Identity.Extensions;
public static class WebApplicationExtensions
{
public static IServiceCollection AddCustomMiddleware(this IServiceCollection services)
{
return services
.AddScoped<ErrorHandlerMiddleware>()
.AddScoped<ClientAuthenticationMiddleware>()
.AddScoped<ClientAuthorizationMiddleware>();
}
public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
{
return app
.UseMiddleware<ErrorHandlerMiddleware>()
.UseMiddleware<ClientAuthenticationMiddleware>()
.UseMiddleware<ClientAuthorizationMiddleware>();
}
}