Skip to content

Commit

Permalink
Merge pull request #128 from domrim/fix/https-token-auth
Browse files Browse the repository at this point in the history
FIX: HTTPS Token Auth verify_ssl propagation
  • Loading branch information
jhollowe committed Dec 20, 2022
2 parents 2e18504 + 0f99336 commit c7d70d7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
9 changes: 8 additions & 1 deletion proxmoxer/backends/https.py
Expand Up @@ -287,7 +287,14 @@ def __init__(
if "token" not in SERVICES[service]["supported_https_auths"]:
config_failure("{} does not support API Token authentication", service)

self.auth = ProxmoxHTTPApiTokenAuth(user, token_name, token_value, service=service)
self.auth = ProxmoxHTTPApiTokenAuth(
user,
token_name,
token_value,
verify_ssl=verify_ssl,
timeout=timeout,
service=service,
)
elif password is not None:
if "password" not in SERVICES[service]["supported_https_auths"]:
config_failure("{} does not support password authentication", service)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_https.py
Expand Up @@ -108,6 +108,22 @@ def test_get_tokens_password(self, mock_pve):

assert ("ticket", "CSRFPreventionToken") == backend.get_tokens()

def test_verify_ssl_token(self):
backend = https.Backend("1.2.3.4:1234", token_name="name")
assert backend.auth.verify_ssl is True

def test_verify_ssl_false_token(self):
backend = https.Backend("1.2.3.4:1234", token_name="name", verify_ssl=False)
assert backend.auth.verify_ssl is False

def test_verify_ssl_password(self, mock_pve):
backend = https.Backend("1.2.3.4:1234", password="name")
assert backend.auth.verify_ssl is True

def test_verify_ssl_false_password(self, mock_pve):
backend = https.Backend("1.2.3.4:1234", password="name", verify_ssl=False)
assert backend.auth.verify_ssl is False


class TestProxmoxHTTPAuthBase:
"""
Expand Down

0 comments on commit c7d70d7

Please sign in to comment.