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.

80 lines
2.5 KiB
C#

using Microsoft.AspNetCore.Builder;
namespace EntrustSettle.Extensions.Middlewares
{
public static class MiddlewareHelpers
{
/// <summary>
/// 自定义授权中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseJwtTokenAuth(this IApplicationBuilder app)
{
return app.UseMiddleware<JwtTokenAuthMiddleware>();
}
/// <summary>
/// 请求响应中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseRequestResponseLogMiddle(this IApplicationBuilder app)
{
return app.UseMiddleware<RequRespLogMiddleware>();
}
/// <summary>
/// SignalR中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseSignalRSendMiddle(this IApplicationBuilder app)
{
return app.UseMiddleware<SignalRSendMiddleware>();
}
/// <summary>
/// 异常处理中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseExceptionHandlerMiddle(this IApplicationBuilder app)
{
return app.UseMiddleware<ExceptionHandlerMiddleware>();
}
/// <summary>
/// IP请求中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseIpLogMiddle(this IApplicationBuilder app)
{
return app.UseMiddleware<IpLogMiddleware>();
}
/// <summary>
/// 用户访问中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseRecordAccessLogsMiddle(this IApplicationBuilder app)
{
return app.UseMiddleware<RecordAccessLogsMiddleware>();
}
9 months ago
/// <summary>
/// AppUser赋值中间件
/// 大简云的ids4返回的token里只有用户id没有Name、公司名称等信息
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseSetAppUserMiddleware(this IApplicationBuilder app)
{
return app.UseMiddleware<SetAppUserMiddleware>();
}
}
}