Fix authentication with Python 3 (see #70)
This commit is contained in:
parent
f253b23a67
commit
a617c4db26
@ -271,8 +271,7 @@ class Application(object):
|
|||||||
authorization = environ.get("HTTP_AUTHORIZATION", None)
|
authorization = environ.get("HTTP_AUTHORIZATION", None)
|
||||||
|
|
||||||
if authorization:
|
if authorization:
|
||||||
authorization = \
|
authorization = authorization.lstrip("Basic").strip()
|
||||||
authorization.decode("ascii").lstrip("Basic").strip()
|
|
||||||
user, password = self.decode(base64.b64decode(
|
user, password = self.decode(base64.b64decode(
|
||||||
authorization.encode("ascii")), environ).split(":", 1)
|
authorization.encode("ascii")), environ).split(":", 1)
|
||||||
else:
|
else:
|
||||||
|
@ -136,7 +136,7 @@ class HtpasswdAuthSystem(BaseTest):
|
|||||||
fd.write(b"tmp:{SHA}" + base64.b64encode(
|
fd.write(b"tmp:{SHA}" + base64.b64encode(
|
||||||
hashlib.sha1(b"bepo").digest()))
|
hashlib.sha1(b"bepo").digest()))
|
||||||
config.set("auth", "type", "htpasswd")
|
config.set("auth", "type", "htpasswd")
|
||||||
self.userpass = base64.b64encode(b"tmp:bepo")
|
self.userpass = "dG1wOmJlcG8="
|
||||||
self.application = radicale.Application()
|
self.application = radicale.Application()
|
||||||
htpasswd.FILENAME = htpasswd_file_path
|
htpasswd.FILENAME = htpasswd_file_path
|
||||||
htpasswd.ENCRYPTION = "sha1"
|
htpasswd.ENCRYPTION = "sha1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user