tor-browser

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

set-authorization.https.html (1232B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="helper.js" type="module"></script>
      6 
      7 <script type="module">
      8  import { expireCookie, documentHasCookie, waitForCookie, addCookieAndSessionCleanup, configureServer, setupShardedServerState } from "./helper.js";
      9 
     10  promise_test(async t => {
     11    await setupShardedServerState();
     12    const expectedCookieAndValue = "auth_cookie=abcdef0123";
     13    addCookieAndSessionCleanup(t);
     14 
     15    // Configure server send back an authorization header for registration.
     16    await configureServer({ authorizationValue: "authcode" });
     17 
     18    // Prompt starting a session, and wait until registration completes.
     19    // The server will confirm that the authorization is sent in registration.
     20    const loginResponse = await fetch('login.py');
     21    assert_equals(loginResponse.status, 200);
     22    await waitForCookie(expectedCookieAndValue, /*expectCookie=*/true);
     23 
     24    // Confirm that registration succeeded (cookie was set).
     25    const authResponse = await fetch('verify_authenticated.py');
     26    assert_equals(authResponse.status, 200);
     27  }, "Session registration sends the authorization value");
     28 </script>