Skip to content

feat: support ClientAssertion authentication for ISV apps - #178

Open
SadMemories wants to merge 2 commits into
v2_mainfrom
feature/isv-client-assertion
Open

SadMemories wants to merge 2 commits into
v2_mainfrom
feature/isv-client-assertion

Conversation

@SadMemories

Copy link
Copy Markdown
Collaborator

商店应用配置 ClientAssertionProvider 后,可在调用业务 API 时使用 tenant_key 自动兑换并缓存 TAT,无需 AppSecret、AppTicket 或 AppAccessToken。

使用现有 OAuth 地址、aud 和代理路由,通过 /oauth/v3/token 发送 client_credentials 请求,并按租户和 OAuth 地址隔离缓存。新增 ISV 响应检查;业务错误信息同时包含 error 和 error_description,响应字段校验失败时说明具体原因,避免将无效 Token 写入缓存。

复用已有 UAT 获取与刷新流程,保持自建应用、AppSecret 模式及各语言原有缓存和重试行为。

验证:运行 ClientAssertion token manager、auth、access token 三组测试,39 项通过。覆盖租户缓存隔离、代理路由、错误透出、失败响应不缓存及现有 UAT 流程。

未执行真实 Token 兑换或发送消息。

Reuse existing OAuth exchanges for ISV tenant tokens with client_credentials and tenant_key, and enable existing UAT flows. Preserve cache and retry behavior, add scoped failure logs, regression tests, and usage documentation.

Change-Id: If787253e21d439e679320127fb6ae4d23dfc9f78
Change-Id: I72a453cca86d273cb05c0aaa9a1f329151d3f8d5
msg += f", error: {resp['error']}"
if resp.get("error_description"):
msg += f", error_description: {resp['error_description']}"
logger.warning("ISV tenant token exchange failed, aud:%s, status:%s, code:%s, msg:%s", aud, raw.status_code, resp.get("code", 0), msg)
msg += f", error: {resp['error']}"
if resp.get("error_description"):
msg += f", error_description: {resp['error_description']}"
logger.warning("ISV tenant token exchange failed, aud:%s, status:%s, code:%s, msg:%s", aud, raw.status_code, resp.get("code", 0), msg)
msg += f", error: {resp['error']}"
if resp.get("error_description"):
msg += f", error_description: {resp['error_description']}"
logger.warning("ISV tenant token exchange failed, aud:%s, status:%s, code:%s, msg:%s", aud, raw.status_code, resp.get("code", 0), msg)
msg = "access_token is empty"
elif int(resp.get("expires_in") or 0) <= 0:
msg = "expires_in must be positive"
logger.warning("invalid ISV tenant token response, aud:%s, msg:%s", aud, msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants