diff options
| author | Navid Pustchi <npustchi@gmail.com> | 2016-02-04 16:45:38 +0000 |
|---|---|---|
| committer | Alvaro Lopez Garcia <aloga@ifca.unican.es> | 2016-06-09 18:00:40 +0200 |
| commit | 6ae0d2e8a54fd5139e63a990ab4bdce634e73c5e (patch) | |
| tree | 5833e88147e71524b49a5b25979fd17869dd455c /openstackclient/api/auth_plugin.py | |
| parent | ada6abb30e6b1c49229817ae53ab96d88c50fd21 (diff) | |
| download | python-openstackclient-6ae0d2e8a54fd5139e63a990ab4bdce634e73c5e.tar.gz | |
Moving authentication from keystoneclient to keystoneauth
Currently OpenStackClient uses keystoneclient for authentication.
This change will update OpenStackClient to use keystoneauth for
authentication.
All dependant test have been updated.
Updating how auth_ref is set in the tests to use KSA fixtures had
some racy side-effects. The user_role_list tests failed when they
picked up an auth_ref that was a fixture. This exposed a weakness
in ListUserRole that needed to be fixed at the same time re
handling of unscoped tokens and options.
Change-Id: I4ddb2dbbb3bf2ab37494468eaf65cef9213a6e00
Closes-Bug: 1533369
Diffstat (limited to 'openstackclient/api/auth_plugin.py')
| -rw-r--r-- | openstackclient/api/auth_plugin.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/openstackclient/api/auth_plugin.py b/openstackclient/api/auth_plugin.py index cff0b75d..44d3b38e 100644 --- a/openstackclient/api/auth_plugin.py +++ b/openstackclient/api/auth_plugin.py @@ -18,13 +18,13 @@ import logging from oslo_config import cfg from six.moves.urllib import parse as urlparse -from keystoneclient.auth.identity.generic import password as ksc_password -from keystoneclient.auth import token_endpoint +from keystoneauth1.loading._plugins import admin_token as token_endpoint +from keystoneauth1.loading._plugins.identity import generic as ksa_password LOG = logging.getLogger(__name__) -class TokenEndpoint(token_endpoint.Token): +class TokenEndpoint(token_endpoint.AdminToken): """Auth plugin to handle traditional token/endpoint usage Implements the methods required to handle token authentication @@ -36,20 +36,15 @@ class TokenEndpoint(token_endpoint.Token): is for bootstrapping the Keystone database. """ - def __init__(self, url, token, **kwargs): + def load_from_options(self, url, token): """A plugin for static authentication with an existing token :param string url: Service endpoint :param string token: Existing token """ - super(TokenEndpoint, self).__init__(endpoint=url, - token=token) + return super(TokenEndpoint, self).load_from_options(endpoint=url, + token=token) - def get_auth_ref(self, session, **kwargs): - # Stub this method for compatibility - return None - - @classmethod def get_options(self): options = super(TokenEndpoint, self).get_options() @@ -65,7 +60,7 @@ class TokenEndpoint(token_endpoint.Token): return options -class OSCGenericPassword(ksc_password.Password): +class OSCGenericPassword(ksa_password.Password): """Auth plugin hack to work around broken Keystone configurations The default Keystone configuration uses http://localhost:xxxx in |
