feat(sso): MaxKey/JNPF/uc 迁移 P0 修复
- /sign/api/oauth/v20/me 归一化盲区:补 /api/oauth/v20/me 路由别名 - scope 逗号+空白切分(authorize 与 has_openid 同口径,避免逗号串吞 id_token) - mobile 身份字段走 User.extra 全链(check_mobile/create/set_profile/claims/me), me 补 MaxKey 别名字段 id/userId/displayName/fullName - 单点注销:/logout、/sign/logout 别名 + redirect_uri 302 回跳 (client 白名单,未登记 400;302 同时清会话 cookie) - 管理员重置密码入口统一过 accounts::check_password - e2e 互通套新增 A2b/A2c/A2d/A2e/A8b 六条断言,六套回归 rc=0
This commit is contained in:
1 parent
71809a4090
commit
6409d42817
5 files changed
+148
-10
No files matched your search
@@ -144,6 +144,26 @@ for P in "/maxkey/oauth/v20/authorize" "/sign/authz/oauth/v20/authorize" "/oauth
|
||||
if [ "$CODE" = "302" ]; then ok "GET $P 命中(context-path 归一化)"; else bad "GET $P 期望 302,实得 $CODE"; fi
|
||||
done
|
||||
|
||||
# A2b. `/sign/api/oauth/v20/me`:MaxKey 真实 userinfo 路径挂在 /sign/api 下
|
||||
# (不是 /sign/authz)——曾是 context-path 归一化盲区,404 回归线
|
||||
CODE="$(curl -s -o /dev/null -w '%{http_code}' "$IDP/sign/api/oauth/v20/me")"
|
||||
if [ "$CODE" != "404" ] && [ "$CODE" != "000" ]; then ok "GET /sign/api/oauth/v20/me 命中(${CODE},非 404)"; else bad "/sign/api/oauth/v20/me 404,归一化盲区回归($CODE)"; fi
|
||||
|
||||
# A2c. 逗号分隔 scope(MaxKey 文档示例写法 "openid,profile,email"):
|
||||
# 校验应通过(未登录 → 302 跳登录),而不是 invalid_scope 400
|
||||
CODE="$(curl -s -o /dev/null -w '%{http_code}' "$IDP/sign/authz/oauth/v20/authorize?client_id=demo-system&response_type=code&redirect_uri=$REDIRECT&scope=openid,profile,email")"
|
||||
if [ "$CODE" = "302" ]; then ok "authorize 逗号 scope 通过(302 跳登录)"; else bad "逗号 scope 被拒(期望 302,实得 $CODE)"; fi
|
||||
|
||||
# A2d. 单点注销裸路径:/sign/logout 经归一化命中
|
||||
CODE="$(curl -s -o /dev/null -w '%{http_code}' "$IDP/sign/logout")"
|
||||
if [ "$CODE" != "404" ] && [ "$CODE" != "000" ]; then ok "GET /sign/logout 命中(${CODE})"; else bad "/sign/logout 未命中($CODE)"; fi
|
||||
|
||||
# A2e. 注销回跳:已登记 redirect_uri → 302;未登记 → 400 拒绝(开放重定向防线)
|
||||
CODE="$(curl -s -o /dev/null -w '%{http_code}' "$IDP/sign/logout?redirect_uri=$REDIRECT")"
|
||||
if [ "$CODE" = "302" ]; then ok "logout 带已登记 redirect_uri → 302 回跳"; else bad "logout 回跳期望 302,实得 $CODE"; fi
|
||||
CODE="$(curl -s -o /dev/null -w '%{http_code}' "$IDP/sign/logout?redirect_uri=http://evil.example.com/cb")"
|
||||
if [ "$CODE" = "400" ]; then ok "logout 未登记 redirect_uri 被拒(400)"; else bad "开放重定向防线失效(期望 400,实得 $CODE)"; fi
|
||||
|
||||
# A3. token 端点别名存在(缺参数应 4xx,而不是 404)
|
||||
CODE="$(curl -s -o /dev/null -w '%{http_code}' -X POST "$IDP/sign/authz/oauth/v20/token" -d 'grant_type=authorization_code')"
|
||||
if [ "$CODE" != "404" ] && [ "$CODE" != "000" ]; then ok "POST /sign/authz/oauth/v20/token 命中(${CODE},非 404)"; else bad "token 别名未命中(${CODE})"; fi
|
||||
@@ -197,6 +217,11 @@ fi
|
||||
ME2="$(curl -s "$IDP/oauth2.0/profile?access_token=$AT")"
|
||||
if [ "$(tj "$ME2" username)" = "alice" ]; then ok "GET /oauth2.0/profile 别名命中"; else bad "/oauth2.0/profile 别名异常:$ME2"; fi
|
||||
|
||||
# A8b. /me 的 MaxKey 别名字段:id/userId(全局身份映射键)+ displayName
|
||||
U_ID2="$(tj "$ME_JSON" id)"
|
||||
U_DN="$(tj "$ME_JSON" displayName)"
|
||||
if [ "$U_ID2" = "alice" ] && [ -n "$U_DN" ]; then ok "/me 别名字段 id/userId/displayName 正常"; else bad "/me 别名字段异常(id=$U_ID2, displayName=$U_DN)"; fi
|
||||
|
||||
# A9. 标准端点不受影响(回归):Bearer 头 + userinfo 信封
|
||||
STD="$(curl -s "$IDP/oauth/userinfo" -H "Authorization: Bearer $AT")"
|
||||
if [ "$(printf '%s' "$STD" | python3 -c "
|
||||
|
||||
Reference in new issue
Block a user