Exemplo n.º 1
0
 /// <summary>
 /// 权限中间件构造
 /// </summary>
 /// <param name="next">管道代理对象</param>
 /// <param name="permissionResitory">权限仓储对象</param>
 /// <param name="option">权限中间件配置选项</param>
 public PermissionMiddleware(RequestDelegate next, IPermissionRepository permissionRepository, PermissionMiddlewareOption option)
 {
     _option = option;
     _permissionRepository = permissionRepository;
     _next = next;
     LoadUserPermissions();
 }
Exemplo n.º 2
0
 /// <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));
 }