22 lines
686 B
C#
22 lines
686 B
C#
using Foxchat.Identity.Middleware;
|
|
|
|
namespace Foxchat.Identity.Extensions;
|
|
|
|
public static class WebApplicationExtensions
|
|
{
|
|
public static IServiceCollection AddCustomMiddleware(this IServiceCollection services)
|
|
{
|
|
return services
|
|
.AddScoped<ErrorHandlerMiddleware>()
|
|
.AddScoped<AuthenticationMiddleware>()
|
|
.AddScoped<AuthorizationMiddleware>();
|
|
}
|
|
|
|
public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
|
|
{
|
|
return app
|
|
.UseMiddleware<ErrorHandlerMiddleware>()
|
|
.UseMiddleware<AuthenticationMiddleware>()
|
|
.UseMiddleware<AuthorizationMiddleware>();
|
|
}
|
|
}
|