Skip to content

Commit a9d1e3d

Browse files
author
Jamie Lennox
committed
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
1 parent 4b867df commit a9d1e3d

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

‎openstackclient/api/auth_plugin.py‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
from oslo_config import cfg
1919
from six.moves.urllib import parse as urlparse
2020

21-
from keystoneclient.auth import base
2221
from keystoneclient.auth.identity.generic import password as ksc_password
23-
22+
from keystoneclient.auth import token_endpoint
2423

2524
LOG = logging.getLogger(__name__)
2625

2726

28-
class TokenEndpoint(base.BaseAuthPlugin):
27+
class TokenEndpoint(token_endpoint.Token):
2928
"""Auth plugin to handle traditional token/endpoint usage
3029
3130
Implements the methods required to handle token authentication
@@ -43,23 +42,13 @@ def __init__(self, url, token, **kwargs):
4342
:param string url: Service endpoint
4443
:param string token: Existing token
4544
"""
46-
super(TokenEndpoint, self).__init__()
47-
self.endpoint = url
48-
self.token = token
49-
50-
def get_endpoint(self, session, **kwargs):
51-
"""Return the supplied endpoint"""
52-
return self.endpoint
53-
54-
def get_token(self, session):
55-
"""Return the supplied token"""
56-
return self.token
45+
super(TokenEndpoint, self).__init__(endpoint=url,
46+
token=token)
5747

5848
def get_auth_ref(self, session, **kwargs):
59-
"""Stub this method for compatibility"""
49+
# Stub this method for compatibility
6050
return None
6151

62-
# Override this because it needs to be a class method...
6352
@classmethod
6453
def get_options(self):
6554
options = super(TokenEndpoint, self).get_options()

0 commit comments

Comments
 (0)