fix test
This commit is contained in:
parent
5b757837a9
commit
b190ff7742
|
@ -199,12 +199,10 @@ describe('2要素認証', () => {
|
||||||
const signinWithoutTokenResponse = await api('signin', {
|
const signinWithoutTokenResponse = await api('signin', {
|
||||||
...signinParam(),
|
...signinParam(),
|
||||||
});
|
});
|
||||||
assert.strictEqual(signinWithoutTokenResponse.status, 403);
|
assert.strictEqual(signinWithoutTokenResponse.status, 200);
|
||||||
assert.deepStrictEqual(signinWithoutTokenResponse.body, {
|
assert.deepStrictEqual(signinWithoutTokenResponse.body, {
|
||||||
error: {
|
finished: false,
|
||||||
id: '144ff4f8-bd6c-41bc-82c3-b672eb09efbf',
|
|
||||||
next: 'totp',
|
next: 'totp',
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const signinResponse = await api('signin', {
|
const signinResponse = await api('signin', {
|
||||||
|
@ -212,6 +210,7 @@ describe('2要素認証', () => {
|
||||||
token: otpToken(registerResponse.body.secret),
|
token: otpToken(registerResponse.body.secret),
|
||||||
});
|
});
|
||||||
assert.strictEqual(signinResponse.status, 200);
|
assert.strictEqual(signinResponse.status, 200);
|
||||||
|
assert.strictEqual(signinResponse.body.finished, true);
|
||||||
assert.notEqual(signinResponse.body.i, undefined);
|
assert.notEqual(signinResponse.body.i, undefined);
|
||||||
|
|
||||||
// 後片付け
|
// 後片付け
|
||||||
|
@ -255,26 +254,20 @@ describe('2要素認証', () => {
|
||||||
const signinResponse = await api('signin', {
|
const signinResponse = await api('signin', {
|
||||||
...signinParam(),
|
...signinParam(),
|
||||||
});
|
});
|
||||||
const signinResponseBody = signinResponse.body as unknown as {
|
assert.strictEqual(signinResponse.status, 200);
|
||||||
error: {
|
assert.strictEqual(signinResponse.body.finished, false);
|
||||||
id: string;
|
assert.strictEqual(signinResponse.body.next, 'passkey');
|
||||||
next: 'passkey';
|
assert.notEqual(signinResponse.body.authRequest.challenge, undefined);
|
||||||
authRequest: PublicKeyCredentialRequestOptionsJSON;
|
assert.notEqual(signinResponse.body.authRequest.allowCredentials, undefined);
|
||||||
};
|
assert.strictEqual(signinResponse.body.authRequest.allowCredentials && signinResponse.body.authRequest.allowCredentials[0]?.id, credentialId.toString('base64url'));
|
||||||
};
|
|
||||||
assert.strictEqual(signinResponse.status, 403);
|
|
||||||
assert.strictEqual(signinResponseBody.error.id, '06e661b9-8146-4ae3-bde5-47138c0ae0c4');
|
|
||||||
assert.strictEqual(signinResponseBody.error.next, 'passkey');
|
|
||||||
assert.notEqual(signinResponseBody.error.authRequest.challenge, undefined);
|
|
||||||
assert.notEqual(signinResponseBody.error.authRequest.allowCredentials, undefined);
|
|
||||||
assert.strictEqual(signinResponseBody.error.authRequest.allowCredentials && signinResponseBody.error.authRequest.allowCredentials[0]?.id, credentialId.toString('base64url'));
|
|
||||||
|
|
||||||
const signinResponse2 = await api('signin', signinWithSecurityKeyParam({
|
const signinResponse2 = await api('signin', signinWithSecurityKeyParam({
|
||||||
keyName,
|
keyName,
|
||||||
credentialId,
|
credentialId,
|
||||||
requestOptions: signinResponseBody.error.authRequest,
|
requestOptions: signinResponse.body.authRequest,
|
||||||
}));
|
}));
|
||||||
assert.strictEqual(signinResponse2.status, 200);
|
assert.strictEqual(signinResponse2.status, 200);
|
||||||
|
assert.strictEqual(signinResponse2.body.finished, true);
|
||||||
assert.notEqual(signinResponse2.body.i, undefined);
|
assert.notEqual(signinResponse2.body.i, undefined);
|
||||||
|
|
||||||
// 後片付け
|
// 後片付け
|
||||||
|
@ -324,28 +317,22 @@ describe('2要素認証', () => {
|
||||||
...signinParam(),
|
...signinParam(),
|
||||||
password: '',
|
password: '',
|
||||||
});
|
});
|
||||||
const signinResponseBody = signinResponse.body as unknown as {
|
assert.strictEqual(signinResponse.status, 200);
|
||||||
error: {
|
assert.strictEqual(signinResponse.body.finished, false);
|
||||||
id: string;
|
assert.strictEqual(signinResponse.body.next, 'passkey');
|
||||||
next: 'passkey';
|
assert.notEqual(signinResponse.body.authRequest.challenge, undefined);
|
||||||
authRequest: PublicKeyCredentialRequestOptionsJSON;
|
assert.notEqual(signinResponse.body.authRequest.allowCredentials, undefined);
|
||||||
};
|
|
||||||
};
|
|
||||||
assert.strictEqual(signinResponse.status, 403);
|
|
||||||
assert.strictEqual(signinResponseBody.error.id, '06e661b9-8146-4ae3-bde5-47138c0ae0c4');
|
|
||||||
assert.strictEqual(signinResponseBody.error.next, 'passkey');
|
|
||||||
assert.notEqual(signinResponseBody.error.authRequest.challenge, undefined);
|
|
||||||
assert.notEqual(signinResponseBody.error.authRequest.allowCredentials, undefined);
|
|
||||||
|
|
||||||
const signinResponse2 = await api('signin', {
|
const signinResponse2 = await api('signin', {
|
||||||
...signinWithSecurityKeyParam({
|
...signinWithSecurityKeyParam({
|
||||||
keyName,
|
keyName,
|
||||||
credentialId,
|
credentialId,
|
||||||
requestOptions: signinResponseBody.error.authRequest,
|
requestOptions: signinResponse.body.authRequest,
|
||||||
} as any),
|
} as any),
|
||||||
password: '',
|
password: '',
|
||||||
});
|
});
|
||||||
assert.strictEqual(signinResponse2.status, 200);
|
assert.strictEqual(signinResponse2.status, 200);
|
||||||
|
assert.strictEqual(signinResponse2.body.finished, true);
|
||||||
assert.notEqual(signinResponse2.body.i, undefined);
|
assert.notEqual(signinResponse2.body.i, undefined);
|
||||||
|
|
||||||
// 後片付け
|
// 後片付け
|
||||||
|
@ -455,6 +442,7 @@ describe('2要素認証', () => {
|
||||||
token: otpToken(registerResponse.body.secret),
|
token: otpToken(registerResponse.body.secret),
|
||||||
});
|
});
|
||||||
assert.strictEqual(signinResponse.status, 200);
|
assert.strictEqual(signinResponse.status, 200);
|
||||||
|
assert.strictEqual(signinResponse.body.finished, true);
|
||||||
assert.notEqual(signinResponse.body.i, undefined);
|
assert.notEqual(signinResponse.body.i, undefined);
|
||||||
|
|
||||||
// 後片付け
|
// 後片付け
|
||||||
|
@ -489,6 +477,7 @@ describe('2要素認証', () => {
|
||||||
...signinParam(),
|
...signinParam(),
|
||||||
});
|
});
|
||||||
assert.strictEqual(signinResponse.status, 200);
|
assert.strictEqual(signinResponse.status, 200);
|
||||||
|
assert.strictEqual(signinResponse.body.finished, true);
|
||||||
assert.notEqual(signinResponse.body.i, undefined);
|
assert.notEqual(signinResponse.body.i, undefined);
|
||||||
|
|
||||||
// 後片付け
|
// 後片付け
|
||||||
|
|
Loading…
Reference in New Issue