Skip to content

Commit

Permalink
Migrate webauthn to the credentialmanager module.
Browse files Browse the repository at this point in the history
This change moves the idl and implementation from
modules/webauth/ to modules/credentialmanager and implements
the creation of a publicKeyCredential via
navigator.credentials.create(). The call uses
WebAuthenticationClient to dispatch publicKeyCredential
operations to the browser-side mojo implementation.

This change also mocks the the browser-side implementation
of authenticator.mojom and adds layout tests using test_runner.

This change freezes the spec at WD05 for interop.
Spec WD05: https://www.w3.org/TR/2017/WD-webauthn-20170505/

Bug: 733029
Change-Id: I4fcd01295f640c7500b815232c8f6cec5b3a2409
Reviewed-on: https://chromium-review.googlesource.com/578729
Commit-Queue: Kim Paulhamus <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Mike West <[email protected]>
Reviewed-by: Balazs Engedy <[email protected]>
WPT-Export-Revision: 6a75a9fa31ec2e2f4e40103849a5231486703e3a
  • Loading branch information
kpaulh authored and chromium-wpt-export-bot committed Aug 16, 2017
1 parent a316994 commit 411dcb1
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,40 @@
navigator.credentials.create({federated: "bogus federated data"}));
}, "navigator.credentials.create() with bogus federated data");

promise_test(function(t) {
return promise_rejects(t, new TypeError(),
navigator.credentials.create({publicKey: "bogus publicKey data"}));
}, "navigator.credentials.create() with bogus publicKey data");

promise_test(function(t) {
var publicKey = {
challenge: new TextEncoder().encode("climb a mountain"),
rp: {
id: "1098237235409872",
name: "Acme"
},

user: {
id: "1098237235409872",
name: "[email protected]",
displayName: "Avery A. Jones",
icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
},

parameters: [{
type: "public-key",
algorithm: "ES256",
},],

timeout: 60000, // 1 minute
excludeList: [], // No excludeList
};

return navigator.credentials.create({publicKey}).then(r => {
assert_true(r instanceof PublicKeyCredential);
});
}, "navigator.credentials.create() returns PublicKeyCredential");

promise_test(function(t) {
var credential_data = {
id: 'id',
Expand All @@ -98,6 +132,31 @@
}));
}, "navigator.credentials.create() with bogus password and federated data");

promise_test(function(t) {
return promise_rejects(t, new TypeError(),
navigator.credentials.create({
federated: "bogus federated data",
publicKey: "bogus publicKey data",
}));
}, "navigator.credentials.create() with bogus federated and publicKey data");

promise_test(function(t) {
return promise_rejects(t, new TypeError(),
navigator.credentials.create({
password: "bogus password data",
publicKey: "bogus publicKey data",
}));
}, "navigator.credentials.create() with bogus password and publicKey data");

promise_test(function(t) {
return promise_rejects(t, new TypeError(),
navigator.credentials.create({
password: "bogus password data",
federated: "bogus federated data",
publicKey: "bogus publicKey data",
}));
}, "navigator.credentials.create() with bogus password, federated, and publicKey data");

promise_test(function(t) {
return promise_rejects(t, "NotSupportedError",
navigator.credentials.create({bogus_key: "bogus data"}));
Expand Down

0 comments on commit 411dcb1

Please sign in to comment.