wxw
2024-08-13 a3236b51b5691b8c47f4ebaf1d885314a4bab3bd
Wms/Utility/Filter/ApiSignatureVerificationAttribute.cs
@@ -91,20 +91,24 @@
            // 反序列化 JSON 参数为 JObject
            JObject jObject = null;
            try
            Dictionary<string, string> filteredProperties = new Dictionary<string, string>();
            if (jsonParams != null)
            {
                jObject = JObject.Parse(jsonParams);
                try
                {
                    jObject = JObject.Parse(jsonParams);
                    // 过滤掉数组类型的属性
                    filteredProperties = jObject.Properties()
                        .Where(p => p.Value.Type != JTokenType.Array)
                        .ToDictionary(p => p.Name, p => p.Value.ToString());
                }
                catch (JsonReaderException)
                {
                    // JSON 格式错误,返回未经授权
                    context.Result = new UnauthorizedResult();
                    return;
                }
            }
            catch (JsonReaderException)
            {
                // JSON 格式错误,返回未经授权
                context.Result = new UnauthorizedResult();
                return;
            }
            // 过滤掉数组类型的属性
            var filteredProperties = jObject.Properties()
                .Where(p => p.Value.Type != JTokenType.Array)
                .ToDictionary(p => p.Name, p => p.Value.ToString());
            filteredProperties.Add("timestamp", timestamp);
            filteredProperties.Add("appKey", appKey);