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 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>
|
|
|
|
|
/// 用户访问中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseRecordAccessLogsMiddle(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<RecordAccessLogsMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// AppUser赋值中间件
|
|
|
|
|
/// 大简云的ids4返回的token里只有用户id,没有Name、公司名称等信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseSetAppUserMiddleware(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<SetAppUserMiddleware>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|