Skip to content

Commit

Permalink
Add certFile and certKeyFile to SoapStubAdapter
Browse files Browse the repository at this point in the history
SoapStubAdapter uses the schemeArgs dictionary to pass HTTPConnection and HTTPSConnection parameters around.
However, with the planned Python 3.12 changes, some parameters will no longer be supported.
This changes adds certFile and certKeyFile as SoapStubAdapter class attributes and updates the current consumers.
  • Loading branch information
ddraganov committed Apr 5, 2024
1 parent 5a2a74e commit 2bbfb62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pyVim/connect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#############################################################
# Copyright (c) 2005-2024 VMware, Inc. All rights reserved.
# Copyright (c) 2005-2024 Broadcom. All Rights Reserved.
# The term "Broadcom" refers to Broadcom Inc.
# and/or its subsidiaries.
#############################################################

# @file connect.py
Expand Down Expand Up @@ -132,8 +134,8 @@ def makeCertHokTokenLoginMethod(stsUrl, stsCert=None, ssl_context=None):

def _doLogin(soapStub):
from . import sso
cert = soapStub.schemeArgs['cert_file']
key = soapStub.schemeArgs['key_file']
cert = soapStub.certFile
key = soapStub.certKeyFile
authenticator = sso.SsoAuthenticator(sts_url=stsUrl,
sts_cert=stsCert)

Expand Down Expand Up @@ -177,8 +179,8 @@ def makeCredBearerTokenLoginMethod(username,

def _doLogin(soapStub):
from . import sso
cert = soapStub.schemeArgs['cert_file']
key = soapStub.schemeArgs['key_file']
cert = soapStub.certFile
key = soapStub.certKeyFile
authenticator = sso.SsoAuthenticator(sts_url=stsUrl,
sts_cert=stsCert)
samlAssertion = authenticator.get_bearer_saml_assertion(
Expand Down
2 changes: 2 additions & 0 deletions pyVmomi/SoapAdapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,8 @@ def __init__(self,
self.pool = []
self.connectionPoolTimeout = connectionPoolTimeout
self.lock = threading.Lock()
self.certFile = certFile
self.certKeyFile = certKeyFile
self.schemeArgs = {}
if sslContext:
self.schemeArgs['context'] = sslContext
Expand Down

0 comments on commit 2bbfb62

Please sign in to comment.