diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 015cf373..6f7349b6 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -949,6 +949,8 @@ def add_auth(ap): ap2.add_argument("--idp-h-grp", metavar="HN", type=u, default="", help="assume the request-header \033[33mHN\033[0m contains the groupname of the requesting user; can be referenced in config files for group-based access control") ap2.add_argument("--idp-h-key", metavar="HN", type=u, default="", help="optional but recommended safeguard; your reverse-proxy will insert a secret header named \033[33mHN\033[0m into all requests, and the other IdP headers will be ignored if this header is not present") ap2.add_argument("--idp-gsep", metavar="RE", type=u, default="|:;+,", help="if there are multiple groups in \033[33m--idp-h-grp\033[0m, they are separated by one of the characters in \033[33mRE\033[0m") + ap2.add_argument("--no-bauth", action="store_true", help="disable basic-authentication support; do not accept passwords from the 'Authenticate' header at all. NOTE: This breaks support for the android app") + ap2.add_argument("--bauth-last", action="store_true", help="keeps basic-authentication enabled, but only as a last-resort; if a cookie is also provided then the cookie wins") def add_zeroconf(ap): diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index c2c32aa8..55467694 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -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") diff --git a/copyparty/svchub.py b/copyparty/svchub.py index c5e73ba4..89b646fa 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -424,6 +424,12 @@ class SvcHub(object): t = "WARNING: found config files in [%s]: %s\n config files are not expected here, and will NOT be loaded (unless your setup is intentionally hella funky)" self.log("root", t % (E.cfg, ", ".join(hits)), 3) + if self.args.no_bauth: + t = "WARNING: --no-bauth disables support for the Android app; you may want to use --bauth-last instead" + self.log("root", t, 3) + if self.args.bauth_last: + self.log("root", "WARNING: ignoring --bauth-last due to --no-bauth", 3) + def _process_config(self) -> bool: al = self.args