Title: [240084] branches/safari-607-branch/LayoutTests
Revision
240084
Author
[email protected]
Date
2019-01-16 15:28:42 -0800 (Wed, 16 Jan 2019)

Log Message

Cherry-pick r239958. rdar://problem/47260195

    Unreviewed, test fixes after r239852.

    * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
    * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
    * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
    * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239958 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-607-branch/LayoutTests/ChangeLog (240083 => 240084)


--- branches/safari-607-branch/LayoutTests/ChangeLog	2019-01-16 23:28:39 UTC (rev 240083)
+++ branches/safari-607-branch/LayoutTests/ChangeLog	2019-01-16 23:28:42 UTC (rev 240084)
@@ -1,3 +1,25 @@
+2019-01-16  Alan Coon  <[email protected]>
+
+        Cherry-pick r239958. rdar://problem/47260195
+
+    Unreviewed, test fixes after r239852.
+    
+    * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+    * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
+    * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+    * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-14  Jiewen Tan  <[email protected]>
+
+            Unreviewed, test fixes after r239852.
+
+            * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+            * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
+            * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+            * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:
+
 2019-01-15  Alan Coon  <[email protected]>
 
         Cherry-pick r239904. rdar://problem/4726030

Modified: branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html (240083 => 240084)


--- branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html	2019-01-16 23:28:39 UTC (rev 240083)
+++ branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html	2019-01-16 23:28:42 UTC (rev 240084)
@@ -47,7 +47,7 @@
                 },
                 challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -70,7 +70,7 @@
                 challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
                 authenticatorSelection: { authenticatorAttachment: "cross-platform" },
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -93,7 +93,7 @@
                 challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
                 authenticatorSelection: { requireResidentKey: false },
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -116,7 +116,7 @@
                 challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
                 authenticatorSelection: { userVerification: "preferred" },
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -139,7 +139,7 @@
                 challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
                 authenticatorSelection: { userVerification: "discouraged" },
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -162,7 +162,7 @@
                 challenge: Base64URL.parse("MTIzNDU2"),
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
                 authenticatorSelection: { authenticatorAttachment: "cross-platform", requireResidentKey: false, userVerification: "preferred" },
-                timeout: 10
+                timeout: 100
             }
         };
 

Copied: branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html (from rev 240083, branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html) (0 => 240084)


--- branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html	                        (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html	2019-01-16 23:28:42 UTC (rev 240084)
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<title>Web Authentication API: PublicKeyCredential's [[create]] success cases with a mock u2f authenticator.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+    function checkResult(credential)
+    {
+        // Check response
+        assert_array_equals(Base64URL.parse(credential.id), Base64URL.parse(testU2fCredentialIdBase64));
+        assert_equals(credential.type, 'public-key');
+        assert_array_equals(new Uint8Array(credential.rawId), Base64URL.parse(testU2fCredentialIdBase64));
+        assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.create","challenge":"MTIzNDU2","origin":"https://localhost:9443"}');
+        assert_throws("NotSupportedError", () => { credential.getClientExtensionResults() });
+
+        // Check attestation
+        const attestationObject = CBOR.decode(credential.response.attestationObject);
+        assert_equals(attestationObject.fmt, "fido-u2f");
+        // Check authData
+        const authData = decodeAuthData(attestationObject.authData);
+        assert_equals(bytesToHexString(authData.rpIdHash), "49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763");
+        assert_equals(authData.flags, 65);
+        assert_equals(authData.counter, 0);
+        assert_equals(bytesToHexString(authData.aaguid), "00000000000000000000000000000000");
+        assert_array_equals(authData.credentialID, Base64URL.parse(testU2fCredentialIdBase64));
+        // Check fido-u2f attestation
+        assert_true(checkPublicKey(authData.publicKey));
+        assert_equals(attestationObject.attStmt.x5c.length, 1);
+    }
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                rp: {
+                    name: "localhost",
+                },
+                user: {
+                    name: "John Appleseed",
+                    id: Base64URL.parse(testUserhandleBase64),
+                    displayName: "Appleseed",
+                },
+                challenge: Base64URL.parse("MTIzNDU2"),
+                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
+                timeout: 100
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
+        return navigator.credentials.create(options).then(credential => {
+            checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[create]] with minimum options in a mock u2f authenticator.");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                rp: {
+                    name: "localhost",
+                },
+                user: {
+                    name: "John Appleseed",
+                    id: Base64URL.parse(testUserhandleBase64),
+                    displayName: "Appleseed",
+                },
+                challenge: Base64URL.parse("MTIzNDU2"),
+                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
+                excludeCredentials: [{ type: "public-key", id: Base64URL.parse(testCredentialIdBase64) }],
+                timeout: 100
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });
+        return navigator.credentials.create(options).then(credential => {
+            checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[create]] with excludeCredentials in a mock u2f authenticator.");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                rp: {
+                    name: "localhost",
+                },
+                user: {
+                    name: "John Appleseed",
+                    id: Base64URL.parse(testUserhandleBase64),
+                    displayName: "Appleseed",
+                },
+                challenge: Base64URL.parse("MTIzNDU2"),
+                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
+                excludeCredentials: [{ type: "public-key", id: Base64URL.parse(testCredentialIdBase64) }, { type: "public-key", id: Base64URL.parse(testCredentialIdBase64) }], // The content doesn't matter.
+                timeout: 100
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });
+        return navigator.credentials.create(options).then(credential => {
+            checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[create]] with excludeCredentials in a mock u2f authenticator. 2");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                rp: {
+                    name: "localhost",
+                },
+                user: {
+                    name: "John Appleseed",
+                    id: Base64URL.parse(testUserhandleBase64),
+                    displayName: "Appleseed",
+                },
+                challenge: Base64URL.parse("MTIzNDU2"),
+                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
+                timeout: 500
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fRegisterResponse] } });
+        return navigator.credentials.create(options).then(credential => {
+            checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[create]] with test of user presence in a mock u2f authenticator.");
+</script>

Modified: branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html (240083 => 240084)


--- branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html	2019-01-16 23:28:39 UTC (rev 240083)
+++ branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html	2019-01-16 23:28:42 UTC (rev 240084)
@@ -28,7 +28,7 @@
         const options = {
             publicKey: {
                 challenge: Base64URL.parse("MTIzNDU2"),
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -44,7 +44,7 @@
                 allowCredentials: [
                     { type: "public-key", id: Base64URL.parse(testHidCredentialIdBase64), transports: ["usb"] }
                 ],
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -58,7 +58,7 @@
             publicKey: {
                 challenge: Base64URL.parse("MTIzNDU2"),
                 userVerification: "preferred",
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -72,7 +72,7 @@
             publicKey: {
                 challenge: Base64URL.parse("MTIzNDU2"),
                 userVerification: "discouraged",
-                timeout: 10
+                timeout: 100
             }
         };
 
@@ -89,7 +89,7 @@
                     { type: "public-key", id: Base64URL.parse(testHidCredentialIdBase64), transports: ["usb"] }
                 ],
                 userVerification: "preferred",
-                timeout: 10
+                timeout: 100
             }
         };
 

Added: branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html (0 => 240084)


--- branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html	                        (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html	2019-01-16 23:28:42 UTC (rev 240084)
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<title>Web Authentication API: PublicKeyCredential's [[get]] success cases with a mock u2f authenticator.</title>
+<script src=""
+<script src=""
+<script src=""
+<script>
+    function checkResult(credential)
+    {
+        // Check respond
+        assert_array_equals(Base64URL.parse(credential.id), Base64URL.parse(testU2fCredentialIdBase64));
+        assert_equals(credential.type, 'public-key');
+        assert_array_equals(new Uint8Array(credential.rawId), Base64URL.parse(testU2fCredentialIdBase64));
+        assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.get","challenge":"MTIzNDU2","origin":"https://localhost:9443"}');
+        assert_equals(credential.response.userHandle, null);
+
+        // Check authData
+        const authData = decodeAuthData(new Uint8Array(credential.response.authenticatorData));
+        assert_equals(bytesToHexString(authData.rpIdHash), "49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763");
+        assert_equals(authData.flags, 1);
+        assert_equals(authData.counter, 59);
+    }
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                challenge: Base64URL.parse("MTIzNDU2"),
+                allowCredentials: [{ type: "public-key", id: Base64URL.parse(testU2fCredentialIdBase64) }],
+                timeout: 100
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
+        return navigator.credentials.get(options).then(credential => {
+            return checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[get]] with minimum options in a mock hid authenticator.");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                challenge: Base64URL.parse("MTIzNDU2"),
+                allowCredentials: [{ type: "public-key", id: Base64URL.parse(testCredentialIdBase64) }, { type: "public-key", id: Base64URL.parse(testU2fCredentialIdBase64) }],
+                timeout: 100
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        return navigator.credentials.get(options).then(credential => {
+            return checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[get]] with more allow credentials in a mock hid authenticator.");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                challenge: Base64URL.parse("MTIzNDU2"),
+                allowCredentials: [{ type: "public-key", id: Base64URL.parse(testU2fCredentialIdBase64) }],
+                timeout: 500
+            }
+        };
+
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fSignResponse] } });
+        return navigator.credentials.get(options).then(credential => {
+            return checkResult(credential);
+        });
+    }, "PublicKeyCredential's [[get]] with test of user presence in a mock hid authenticator.");
+</script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to