diff options
author | Charles Hsu <charles0126@gmail.com> | 2019-12-18 00:32:36 +0800 |
---|---|---|
committer | Charles Hsu <charles0126@gmail.com> | 2020-04-16 12:41:04 +0800 |
commit | 02b637cdca6963e8dcab5170422347df99606f92 (patch) | |
tree | e245ccc06d484fbc6981deff47cf3f50018d8d52 /swiftclient/service.py | |
parent | c36616292fa27d5da956d58fcb20470e04fd9946 (diff) | |
download | python-swiftclient-02b637cdca6963e8dcab5170422347df99606f92.tar.gz |
Support v3 application credentials auth.
Use keystoneauth1 application credential plugin and session to fetch
a token and endpoint catalog url.
$ swift --os-auth-url http://172.16.1.2:5000/v3 --auth-version 3\
--os-application-credential-id THE_ID \
--os-application-credential-secret THE_SECRET \
--os-auth-type v3applicationcredential auth
Change-Id: I9190e5e7e24b6a741970fa0d0ac792deccf73d25
Closes-Bug: 1843901
Closes-Bug: 1856635
Diffstat (limited to 'swiftclient/service.py')
-rw-r--r-- | swiftclient/service.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py index fb334fd..b89399f 100644 --- a/swiftclient/service.py +++ b/swiftclient/service.py @@ -110,6 +110,9 @@ def process_options(options): else: options['auth_version'] = '2.0' + if options.get('os_auth_type', None) == 'v3applicationcredential': + options['auth_version'] == '3' + # Use new-style args if old ones not present if not options['auth'] and options['os_auth_url']: options['auth'] = options['os_auth_url'] @@ -134,6 +137,11 @@ def process_options(options): 'auth_token': options['os_auth_token'], 'object_storage_url': options['os_storage_url'], 'region_name': options['os_region_name'], + 'auth_type': options['os_auth_type'], + 'application_credential_id': + options['os_application_credential_id'], + 'application_credential_secret': + options['os_application_credential_secret'], } @@ -162,6 +170,11 @@ def _build_default_global_options(): "os_project_domain_id": environ.get('OS_PROJECT_DOMAIN_ID'), "os_auth_url": environ.get('OS_AUTH_URL'), "os_auth_token": environ.get('OS_AUTH_TOKEN'), + "os_auth_type": environ.get('OS_AUTH_TYPE'), + "os_application_credential_id": + environ.get('OS_APPLICATION_CREDENTIAL_ID'), + "os_application_credential_secret": + environ.get('OS_APPLICATION_CREDENTIAL_SECRET'), "os_storage_url": environ.get('OS_STORAGE_URL'), "os_region_name": environ.get('OS_REGION_NAME'), "os_service_type": environ.get('OS_SERVICE_TYPE'), |