hwh
2024-06-21 c00475aec109bfbde3781bd2c4899b8d1a040a07
处理非空参数验签
1个文件已修改
12 ■■■■■ 已修改文件
Wms/Utility/Filter/ApiSignatureVerificationAttribute.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Utility/Filter/ApiSignatureVerificationAttribute.cs
@@ -59,9 +59,16 @@
            // 反序列化 JSON 参数为 JObject
            JObject jObject = null;
            Dictionary<string, string> filteredProperties = new Dictionary<string, string>();
            if (jsonParams != null)
            {
            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)
            {
@@ -69,10 +76,7 @@
                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);