Skip to content

Commit 2e1d315

Browse files
committed
blank password should be acceptable
Solves issue #479
1 parent 0474d9b commit 2e1d315

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

caldav/davclient.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,16 @@ def request(
707707
):
708708
auth_types = self.extract_auth_types(r_headers["WWW-Authenticate"])
709709

710-
if self.password and self.username and "digest" in auth_types:
710+
if self.username and "digest" in auth_types:
711711
self.auth = niquests.auth.HTTPDigestAuth(self.username, self.password)
712-
elif self.password and self.username and "basic" in auth_types:
712+
elif self.username and "basic" in auth_types:
713713
self.auth = niquests.auth.HTTPBasicAuth(self.username, self.password)
714714
elif self.password and "bearer" in auth_types:
715715
self.auth = HTTPBearerAuth(self.password)
716+
elif "bearer" in auth_types:
717+
raise error.AuthorizationError(
718+
reason="Server provides bearer auth, but no password given. The bearer token should be configured as password"
719+
)
716720
else:
717721
raise NotImplementedError(
718722
"The server does not provide any of the currently "

tests/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def teardown_radicale(self):
138138
"url": url,
139139
"name": "LocalRadicale",
140140
"username": "user1",
141-
"password": "any-password-seems-to-work",
141+
"password": "",
142142
"backwards_compatibility_url": url + "user1",
143143
"incompatibilities": compatibility_issues.radicale,
144144
"setup": setup_radicale,

0 commit comments

Comments
 (0)