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 Admin.Core.Extensions
|
|
|
|
|
{
|
|
|
|
|
public static class MiddlewareHelpers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自定义授权中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseJwtTokenAuth(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<JwtTokenAuth>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求响应中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseReuestResponseLog(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<RequRespLogMildd>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// SignalR中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseSignalRSendMildd(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<SignalRSendMildd>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 异常处理中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseExceptionHandlerMidd(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<ExceptionHandlerMidd>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// IP请求中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseIPLogMildd(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<IPLogMildd>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 用户访问中间件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="app"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IApplicationBuilder UseRecordAccessLogsMildd(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
return app.UseMiddleware<RecordAccessLogsMildd>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|