From a9d1e3d2192aa965d15c89eb6a603faf2e95b7ec Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Wed, 4 Mar 2015 14:59:24 +1100 Subject: [PATCH] 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 --- openstackclient/api/auth_plugin.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/openstackclient/api/auth_plugin.py b/openstackclient/api/auth_plugin.py index a995476ae0..deddfcc48f 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()