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