Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added x509 certificate support to cli #2174

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions SoftLayer/API.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ def employee_client(username=None,
access_token = settings.get('access_token')

user_id = settings.get('userid')

# Assume access_token is valid for now, user has logged in before at least.
if access_token and user_id:
if settings.get('auth_cert', False):
auth = slauth.X509Authentication(settings.get('auth_cert'), verify)
return EmployeeClient(auth=auth, transport=transport, config_file=config_file)
elif access_token and user_id:
auth = slauth.EmployeeAuthentication(user_id, access_token)
return EmployeeClient(auth=auth, transport=transport, config_file=config_file)
else:
Expand Down
6 changes: 4 additions & 2 deletions SoftLayer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-r
'proxy': '',
'userid': '',
'access_token': '',
'verify': "True"
'verify': "True",
'auth_cert': ''
})
config.read(config_files)

Expand All @@ -74,7 +75,8 @@ def get_client_settings_config_file(**kwargs): # pylint: disable=inconsistent-r
'api_key': config.get('softlayer', 'api_key'),
'userid': config.get('softlayer', 'userid'),
'access_token': config.get('softlayer', 'access_token'),
'verify': config.get('softlayer', 'verify')
'verify': config.get('softlayer', 'verify'),
'auth_cert': config.get('softlayer', 'auth_cert')
}
if r_config["verify"].lower() == "true":
r_config["verify"] = True
Expand Down
Loading