private void ResetMsg(HttpMsg msg) { if (responseList.Remove(msg)) { cacheList.Add(msg); } }
/// <summary>得到一个HttpMsg对象</summary> private HttpMsg OnGetHttpMsg() { HttpMsg httpMsg = null; if (cacheList.Count > 0) { httpMsg = cacheList[0]; cacheList.RemoveAt(0); } if (httpMsg == null) { httpMsg = new HttpMsg(); } waittingList.Add(httpMsg); return(httpMsg); }
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement) { try { var httpContext = contextAccessor.HttpContext.Request; // //是否经过验证 var isAuthenticated = context.User.Identity.IsAuthenticated; if (isAuthenticated) { context.Succeed(requirement); } } catch (Exception ex) { HttpMsg httpMsg = new HttpMsg(); httpMsg.HttpContextmsg(StatusCodes.Status200OK, contextAccessor, ex.Message, 30002); } return(Task.CompletedTask); }