mirror of
https://github.com/9001/copyparty.git
synced 2026-04-05 15:28:07 +10:00
configurable basic-auth preference;
adds options `--bauth-last` to lower the preference for taking the basic-auth password in case of conflict, and `--no-bauth` to entirely disable basic-authentication if a client is providing multiple passwords, for example when "logged in" with one password (the `cppwd` cookie) and switching to another account by also sending a PW header/url-param, then the default evaluation order to determine which password to use is: url-param `pw`, header `pw`, basic-auth header, cookie (cppwd/cppws) so if a client supplies a basic-auth header, it will ignore the cookie and use the basic-auth password instead, which usually makes sense but this can become a problem if you have other webservers running on the same domain which also support basic-authentication --bauth-last is a good choice for cooperating with such services, as --no-bauth currently breaks support for the android app...
This commit is contained in:
@@ -443,7 +443,11 @@ class HttpCli(object):
|
||||
|
||||
zso = self.headers.get("authorization")
|
||||
bauth = ""
|
||||
if zso:
|
||||
if (
|
||||
zso
|
||||
and not self.args.no_bauth
|
||||
and (not cookie_pw or not self.args.bauth_last)
|
||||
):
|
||||
try:
|
||||
zb = zso.split(" ")[1].encode("ascii")
|
||||
zs = base64.b64decode(zb).decode("utf-8")
|
||||
|
||||
Reference in New Issue
Block a user