From 547f98d309ffa5d8ba29ebc468f9057ae0b862e8 Mon Sep 17 00:00:00 2001 From: Erik Jaegervall Date: Fri, 10 May 2024 13:34:26 +0200 Subject: [PATCH] Fixing Dataserver token handling --- kuksa-client/kuksa_client/cli_backend/ws.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kuksa-client/kuksa_client/cli_backend/ws.py b/kuksa-client/kuksa_client/cli_backend/ws.py index effd204..5938bf4 100644 --- a/kuksa-client/kuksa_client/cli_backend/ws.py +++ b/kuksa-client/kuksa_client/cli_backend/ws.py @@ -297,8 +297,13 @@ async def connect(self, _=None): subprotocols = ["VISSv2"] if not self.insecure: context = ssl.create_default_context() - context.load_cert_chain( - certfile=self.certificate, keyfile=self.keyfile) + if self.certificate is not None and \ + self.keyfile is not None: + logger.debug("Credentials used for mutual authentication; " + "Client certificate file = %s, Client key file = %s", + self.certificate, self.keyfile) + context.load_cert_chain( + certfile=self.certificate, keyfile=self.keyfile) context.load_verify_locations(cafile=self.cacertificate) # We want host name to match # For example certificates we use subjectAltName to make it match for Server, localahost and 127.0.0.1