-
Notifications
You must be signed in to change notification settings - Fork 364
Expand file tree
/
Copy pathMiddlewareHelpers.cs
More file actions
87 lines (76 loc) · 2.88 KB
/
MiddlewareHelpers.cs
File metadata and controls
87 lines (76 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/***********************************************************************
* Project: CoreCms.Net *
* Web: https://CoreCms.Net *
* ProjectName: 核心内容管理系统 *
* Author: 大灰灰 *
* Email: JianWeie@163.com *
* Versions: 1.0 *
* CreateTime: 2020-02-03 23:29:27
* FileName: MiddlewareHelpers
* ClassDescription:
***********************************************************************/
using CoreCms.Net.Core;
using Microsoft.AspNetCore.Builder;
namespace CoreCms.Net.Middlewares
{
/// <summary>
/// 中间件
/// </summary>
public static class MiddlewareHelpers
{
/// <summary>
/// 请求响应中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseRequestResponseLog(this IApplicationBuilder app)
{
return app.UseMiddleware<RequRespLogMildd>();
}
/// <summary>
/// 异常处理中间件(后端模式)
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseExceptionHandlerMiddForAdmin(this IApplicationBuilder app)
{
return app.UseMiddleware<ExceptionHandlerMiddForAdmin>();
}
/// <summary>
/// 异常处理中间件(客户端)
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseExceptionHandlerMiddForClent(this IApplicationBuilder app)
{
return app.UseMiddleware<ExceptionHandlerMiddForClent>();
}
/// <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>();
}
/// <summary>
/// Swagger授权中间件
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseSwaggerAuthorizedMildd(this IApplicationBuilder app)
{
return app.UseMiddleware<SwaggerBasicAuthMiddleware>();
}
}
}