Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[webauthn] Fix resident key credentials.get() WPT (#22576)
Fix the empty allowCredentials credentials.get() WPT. The test was expecting the browser to return a non-resident credential with an undefined allowCredentials list (which defaults to empty). Moreover, the test helper itself was failing because it was expecting a credential to be added to the test. Instead, move the test to its own file that sets up the test environment to support resident keys and add rk support to the helper with the isResidentKeyTest flag that avoids appending credentials to allowCredentials. Bug: 875444 Change-Id: I8baefa3a74c2a707227df430712a09935c1fbbf1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130671 Reviewed-by: Martin Kreichgauer <martinkr@google.com> Commit-Queue: Nina Satragno <nsatragno@chromium.org> Cr-Commit-Position: refs/heads/master@{#755344} Co-authored-by: Nina Satragno <nsatragno@chromium.org>
- Loading branch information
1 parent
1422c81
commit 842c83b
Showing
3 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>WebAuthn credential.get() Resident Key Passing Tests</title> | ||
<meta name="timeout" content="long"> | ||
<link rel="help" href="hhttps://w3c.github.io/webauthn/#resident-credential"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src=helpers.js></script> | ||
<body></body> | ||
<script> | ||
standardSetup(function() { | ||
"use strict"; | ||
|
||
// create a resident key credential | ||
var credPromise = createCredential({ | ||
options: { | ||
publicKey: { | ||
authenticatorSelection: { | ||
requireResidentKey: true, | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// empty allowCredential should find the requireResidentKey: true credential | ||
new GetCredentialsTest({path: "options.publicKey.allowCredentials", value: []}) | ||
.addCredential(credPromise) | ||
.setIsResidentKeyTest(true) | ||
.runTest("empty allowCredentials"); | ||
|
||
// undefined allowCredential should be equivalent to empty | ||
new GetCredentialsTest({path: "options.publicKey.allowCredentials", value: undefined}) | ||
.addCredential(credPromise) | ||
.setIsResidentKeyTest(true) | ||
.runTest("undefined allowCredentials"); | ||
}, { | ||
// browsers may not allow resident key credential creation without uv | ||
protocol: "ctap2", | ||
hasResidentKey: true, | ||
hasUserVerification: true, | ||
isUserVerified: true, | ||
}); | ||
|
||
/* JSHINT */ | ||
/* globals standardSetup, GetCredentialsTest, createCredential */ | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters