diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
commit | 4fb11cd5966461bccc3ed1599b808237be6b0de9 (patch) | |
tree | d7f0ccd49cebb3544d52635ff1bd6ed4d763823f /toolkit/mozapps/webextensions/test/xpinstall/authRedirect.sjs | |
parent | f164d9124708b50789dbb6959e1de96cc5697c48 (diff) | |
download | UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.gz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.lz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.xz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.zip |
Move WebExtensions enabled Add-ons Manager
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpinstall/authRedirect.sjs')
-rw-r--r-- | toolkit/mozapps/webextensions/test/xpinstall/authRedirect.sjs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpinstall/authRedirect.sjs b/toolkit/mozapps/webextensions/test/xpinstall/authRedirect.sjs new file mode 100644 index 000000000..85d448e2b --- /dev/null +++ b/toolkit/mozapps/webextensions/test/xpinstall/authRedirect.sjs @@ -0,0 +1,21 @@ +// Simple script redirects to the query part of the uri if the browser +// authenticates with username "testuser" password "testpass" + +function handleRequest(request, response) { + if (request.hasHeader("Authorization")) { + if (request.getHeader("Authorization") == "Basic dGVzdHVzZXI6dGVzdHBhc3M=") { + response.setStatusLine(request.httpVersion, 302, "Found"); + response.setHeader("Location", request.queryString); + response.write("See " + request.queryString); + } + else { + response.setStatusLine(request.httpVersion, 403, "Forbidden"); + response.write("Invalid credentials"); + } + } + else { + response.setStatusLine(request.httpVersion, 401, "Authentication required"); + response.setHeader("WWW-Authenticate", "basic realm=\"XPInstall\"", false); + response.write("Unauthenticated request"); + } +} |