You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using djy_AfrApi.Milldlewares;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
|
|
|
|
namespace djy_AfrApi.Middlewares
|
|
|
|
|
{
|
|
|
|
|
public static class MiddlewareHelpers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 异常处理
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IApplicationBuilder UseExceptionHandlerMiddle(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<ExceptionHandlerMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 处理特殊情况下的响应格式(401、403)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IApplicationBuilder UseUnifyResultMiddleware(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<UnifyResultMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 二次验证授权,并保存当前登录人User对象(为了和ISF、AMS逻辑保持一致)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IApplicationBuilder UseNextAuthorizationMiddle(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<NextAuthorizationMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 记录请求和响应数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IApplicationBuilder UseRequRespLogMiddleware(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<RequRespLogMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公共数据缓存中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IApplicationBuilder UseCommonCacheMiddleware(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<CommonDataCacheMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|