1 Star 0 Fork 0

简道云/webhook-demo-dotnet

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Lizijun- Lizijun .net eb16e75 7 years ago
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

简道云 Webhook 接收演示

此项目包含各语言环境下,接受简道云 Webhook 回调请求并验证签名的简单演示工程。默认服务端启动在 3100 端口,签名使用的默认密钥为 test-secert

签名验证流程

  1. 为了防止 webhook 接收接口被第三方恶意攻击,用户在开发回调接口时,建议对回调请求进行签名校验,以确保回调请求来源来自于简道云。
  2. 获取 POST 请求体 body 内容,序列化为计算签名使用的 payload
  3. 获取请求参数中的nonce和timestamp
  4. 将 payload 与签名密钥 secret 按照 "<nonce>:<payload>:<secret>:<timestamp>" 的形式组合为校验字符串 content
  5. 以 utf-8 编码形式计算 content 的 sha-1 散列
  6. 将 content 散列的十六进制字符串与 POST 请求 header 中的 'X-JDY-Signature' 做比较
  7. 若比较结果相同,则通过签名验证;若比较结果不同,则无法通过检查

演示工程使用 ASP.NET Core 框架,经过 dotnet 1.0.4 环境测试。 安装链接

使用前请安装相关依赖:

dotnet restore

启动运行

dotnet run

Empty file

About

Cancel

Releases

No release

Contributors

All

Activities

can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/jiandaoyun/webhook-demo-dotnet.git
git@gitee.com:jiandaoyun/webhook-demo-dotnet.git
jiandaoyun
webhook-demo-dotnet
webhook-demo-dotnet
master

Search

371d5123 14472233 46e8bd33 14472233