You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chenchuchuan
e522c08377
feat(edayun): 对接获取 token(POST /oauth/token)
按文档实现鉴权第一段:
- auth/EdayunTokenClient:POST /oauth/token,body 用 client_id / client_secret
(下划线风格照文档),无业务请求头
- http/EdayunRequestFactory:构造 token 请求;另备了业务请求构造(token / appKey /
timestamp / sign 四个头)与 sign() = MD5(body + "." + appSecret)
- adapter/EdayunAdapter.token(ctx):走 TokenManager 缓存,按 appKey + clientId 维度
- 工厂构造函数接收 TokenStore / LockProvider / Clock,与信仓同构
**文档只给了 code 取值(200/500/503/504),没给响应体结构**,所以做了兼容:
优先 data.access_token + data.expires_in,其次 data.expiry(绝对时刻),
再其次顶层 token;都没有则失败并带出截断的原始报文,不猜。
有效期同样三级兜底,最后按 2 小时(常量里标了「待联调确认」)。
错误分级:
- 500 明确失败,不重试
- 503 网关无效 / 504 超时,标记 retryable
- HTTP 非 2xx 单独处理,5xx(除 504)可重试
测试 12 个:请求形状、三种响应形态、无 token、500 不可重试、
503/504 可重试、缺 code、非 2xx、凭据缺失不发请求、MD5 签名(独立实现对照)、
空 body 签名。
全量 533 个测试通过。
Co-Authored-By: Claude <noreply@anthropic.com>
|
1 week ago |
| .. |
|
src
|
feat(edayun): 对接获取 token(POST /oauth/token)
|
1 week ago |
|
pom.xml
|
feat(edayun): 新建易达云适配器骨架
|
1 week ago |