tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fedcm-returning-account-auto-reauthn.https.html (1603B)


      1 <!DOCTYPE html>
      2 <title>Federated Credential Management API network request tests.</title>
      3 <link rel="help" href="https://fedidcg.github.io/FedCM">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 
      9 <script type="module">
     10 import {request_options_with_mediation_optional,
     11        fedcm_test,
     12        select_manifest,
     13        fedcm_get_and_select_first_account} from './support/fedcm-helper.sub.js';
     14 
     15 fedcm_test(async t => {
     16  let test_options = request_options_with_mediation_optional("manifest_with_single_account.json");
     17  await select_manifest(t, test_options);
     18 
     19  // Signs in john_doe so that they will be a returning user
     20  let cred = await fedcm_get_and_select_first_account(t, test_options);
     21  assert_equals(cred.token, "account_id=john_doe");
     22 
     23  test_options = request_options_with_mediation_optional("manifest_with_two_accounts.json");
     24  await select_manifest(t, test_options);
     25 
     26  // There are two accounts "Jane" and "John" returned in that order. Without
     27  // auto re-authn, the first account "Jane" would be selected and an token
     28  // would be issued to that account. However, since "John" is returning and
     29  // "Jane" is a new user, the second account "John" will be selected.
     30  cred = await navigator.credentials.get(test_options);
     31  assert_equals(cred.token, "account_id=john_doe");
     32  assert_equals(cred.isAutoSelected, true);
     33 }, "Test that the returning account from the two accounts will be auto re-authenticated.");
     34 </script>