/// <summary> /// 权限中间件构造 /// </summary> /// <param name="next">管道代理对象</param> /// <param name="permissionResitory">权限仓储对象</param> /// <param name="option">权限中间件配置选项</param> public PermissionMiddleware(RequestDelegate next, PermissionMiddlewareOption option) { _option = option; _next = next; _userPermissions = option.UserPerssions; }
/// <summary> /// 引入权限中间件 /// </summary> /// <param name="builder">扩展类型</param> /// <param name="option">权限中间件配置选项</param> /// <returns></returns> public static IApplicationBuilder UsePermission(this IApplicationBuilder builder, PermissionMiddlewareOption option) { return(builder.UseMiddleware <PermissionMiddleware>(option)); }