- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
58 lines
2.4 KiB
JavaScript
58 lines
2.4 KiB
JavaScript
/**
|
||
* TC-IDENTITY_API-012 · 条件不满足时不能办理身份认证(同 REQ-048,连接器之间交互)
|
||
* REQ-061 [FL-1.2] 反向/等价类 P0
|
||
*
|
||
* 前置:通过已认证的调用方连接器调用"身份认证"接口可以正常打开 / 已准备无权限账号或错误数据
|
||
* 步骤:调用"身份认证"接口 → 使用无权限账号或错误数据办理身份认证 → 提交,查看提示与数据
|
||
* 预期:系统不允许办理身份认证,并说明原因。原有数据和状态不变。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-IDENTITY_API-012',
|
||
req: 'REQ-061',
|
||
title: '条件不满足时不能办理身份认证',
|
||
type: '反向/等价类',
|
||
priority: 'P0',
|
||
route: '',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
await t.step('前置:证明正向还能成功(合法 login 一次)', async () => {
|
||
await t.login()
|
||
t.assert(!!t.token, '合法 login 拿到 token(接口可达)')
|
||
})
|
||
|
||
await t.step('反向 1:错误口令拒绝', async () => {
|
||
const res = await fetch('http://localhost:30000/api/oauth/Login', {
|
||
method: 'POST',
|
||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'App-Code': 'sswflow', 'Jnpf-Origin': 'pc', 'Vue-Version': '3' },
|
||
body: new URLSearchParams({
|
||
account: 'admin',
|
||
password: 'd4958348e22108119b3ef57b022c83f4bf857dd0b247eaab15b9a43d47ee3c503900f7135bf0de255bc33620c3cdc02a',
|
||
grant_type: 'password'
|
||
}).toString()
|
||
})
|
||
const json = await res.json()
|
||
t.assert(json.code !== 200, `错误口令被拒(code=${json.code} msg=${json.msg})`)
|
||
})
|
||
|
||
await t.step('反向 2:未知账号拒绝', async () => {
|
||
const res = await fetch('http://localhost:30000/api/oauth/Login', {
|
||
method: 'POST',
|
||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'App-Code': 'sswflow', 'Jnpf-Origin': 'pc', 'Vue-Version': '3' },
|
||
body: new URLSearchParams({
|
||
account: 'e2e_no_such_acct_xyz',
|
||
password: 'd4958348e22108119b3ef57b022c83f4bf857dd0b247eaab15b9a43d47ee3c503900f7135bf0de255bc33620c3cdc02b',
|
||
grant_type: 'password'
|
||
}).toString()
|
||
})
|
||
const json = await res.json()
|
||
t.assert(json.code !== 200, `未知账号被拒(code=${json.code} msg=${json.msg})`)
|
||
})
|
||
|
||
await t.step('核对:合法 login 仍可成功(原有状态不变)', async () => {
|
||
await t.login()
|
||
t.assert(!!t.token, '合法 login 仍可成功(系统未被错误请求污染)')
|
||
})
|
||
}
|