public bool ValidateJwtAuthentication(ServiceRoute route, Dictionary <string, object> model, ref ServiceResult <object> result) { bool isSuccess = true; var author = HttpContext.Request.Headers["Authorization"].ToString(); if (author.StartsWith("Bearer ")) { author = author.Substring(7); } if (!string.IsNullOrEmpty(author)) { isSuccess = _authorizationServerProvider.ValidateClientAuthentication(author).Result; if (!isSuccess) { result = new ServiceResult <object> { IsSucceed = false, StatusCode = (int)MessageStatusCode.UnAuthentication, Message = "不合法的身份凭证" }; } else { var keyValue = model.FirstOrDefault(); if (!(keyValue.Value is IConvertible) || !typeof(IConvertible).GetTypeInfo().IsAssignableFrom(keyValue.Value.GetType())) { var payload = _authorizationServerProvider.GetPayLoad(author); RpcContext.GetContext().SetAttachment("payload", payload); } } } else { result = new ServiceResult <object> { IsSucceed = false, StatusCode = (int)MessageStatusCode.UnAuthentication, Message = "请先登录系统" }; isSuccess = false; } return(isSuccess); }