Skip to content

Commit

Permalink
Merge pull request #1427 from pbiering/password-mechanism-auto
Browse files Browse the repository at this point in the history
fix for incomplete #1425 and test
  • Loading branch information
pbiering committed Mar 12, 2024
2 parents caefa48 + 3628514 commit dc21aa1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions radicale/auth/htpasswd.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def __init__(self, configuration: config.Configuration) -> None:
self._verify = self._plain
elif encryption == "md5":
self._verify = self._md5apr1
elif encryption == "sha256":
self._verify = self._sha256
elif encryption == "sha512":
self._verify = self._sha512
elif encryption == "bcrypt" or encryption == "autodetect":
try:
import bcrypt
Expand Down
6 changes: 6 additions & 0 deletions radicale/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def test_htpasswd_md5_unicode(self):
self._test_htpasswd(
"md5", "😀:$apr1$w4ev89r1$29xO8EvJmS2HEAadQ5qy11", "unicode")

def test_htpasswd_sha256(self) -> None:
self._test_htpasswd("sha256", "tmp:$5$i4Ni4TQq6L5FKss5$ilpTjkmnxkwZeV35GB9cYSsDXTALBn6KtWRJAzNlCL/")

def test_htpasswd_sha512(self) -> None:
self._test_htpasswd("sha512", "tmp:$6$3Qhl8r6FLagYdHYa$UCH9yXCed4A.J9FQsFPYAOXImzZUMfvLa0lwcWOxWYLOF5sE/lF99auQ4jKvHY2vijxmefl7G6kMqZ8JPdhIJ/")

def test_htpasswd_bcrypt(self) -> None:
self._test_htpasswd("bcrypt", "tmp:$2y$05$oD7hbiQFQlvCM7zoalo/T.MssV3V"
"NTRI3w5KDnj8NTUKJNWfVpvRq")
Expand Down

0 comments on commit dc21aa1

Please sign in to comment.