diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2015-03-04 14:59:24 +1100 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2015-03-11 19:16:18 +1100 |
| commit | a9d1e3d2192aa965d15c89eb6a603faf2e95b7ec (patch) | |
| tree | 4b1668df68418269764f34e0fcdf6efca3a1b1b0 /openstackclient | |
| parent | 4b867dfdb0946551bb937e052ad4c907817d9570 (diff) | |
| download | python-openstackclient-a9d1e3d2192aa965d15c89eb6a603faf2e95b7ec.tar.gz | |
Base TokenEndpoint plugin on keystoneclient's
Keystoneclient has always provided a TokenEndpoint plugin. Unfortunately
it uses a different option name for url, so subclass the original and
replace the options.
Change-Id: I7e16b31ceb9f75f1c1f6bfb224d8f8f353d06150
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/api/auth_plugin.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/openstackclient/api/auth_plugin.py b/openstackclient/api/auth_plugin.py index a995476a..deddfcc4 100644 --- a/openstackclient/api/auth_plugin.py +++ b/openstackclient/api/auth_plugin.py @@ -18,14 +18,13 @@ import logging from oslo_config import cfg from six.moves.urllib import parse as urlparse -from keystoneclient.auth import base from keystoneclient.auth.identity.generic import password as ksc_password - +from keystoneclient.auth import token_endpoint LOG = logging.getLogger(__name__) -class TokenEndpoint(base.BaseAuthPlugin): +class TokenEndpoint(token_endpoint.Token): """Auth plugin to handle traditional token/endpoint usage Implements the methods required to handle token authentication @@ -43,23 +42,13 @@ class TokenEndpoint(base.BaseAuthPlugin): :param string url: Service endpoint :param string token: Existing token """ - super(TokenEndpoint, self).__init__() - self.endpoint = url - self.token = token - - def get_endpoint(self, session, **kwargs): - """Return the supplied endpoint""" - return self.endpoint - - def get_token(self, session): - """Return the supplied token""" - return self.token + super(TokenEndpoint, self).__init__(endpoint=url, + token=token) def get_auth_ref(self, session, **kwargs): - """Stub this method for compatibility""" + # Stub this method for compatibility return None - # Override this because it needs to be a class method... @classmethod def get_options(self): options = super(TokenEndpoint, self).get_options() |
