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
This commit is contained in:
parent
4b867dfdb0
commit
a9d1e3d219
@ -18,14 +18,13 @@ import logging
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from six.moves.urllib import parse as urlparse
|
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.identity.generic import password as ksc_password
|
||||||
|
from keystoneclient.auth import token_endpoint
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TokenEndpoint(base.BaseAuthPlugin):
|
class TokenEndpoint(token_endpoint.Token):
|
||||||
"""Auth plugin to handle traditional token/endpoint usage
|
"""Auth plugin to handle traditional token/endpoint usage
|
||||||
|
|
||||||
Implements the methods required to handle token authentication
|
Implements the methods required to handle token authentication
|
||||||
@ -43,23 +42,13 @@ class TokenEndpoint(base.BaseAuthPlugin):
|
|||||||
:param string url: Service endpoint
|
:param string url: Service endpoint
|
||||||
:param string token: Existing token
|
:param string token: Existing token
|
||||||
"""
|
"""
|
||||||
super(TokenEndpoint, self).__init__()
|
super(TokenEndpoint, self).__init__(endpoint=url,
|
||||||
self.endpoint = url
|
token=token)
|
||||||
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
|
|
||||||
|
|
||||||
def get_auth_ref(self, session, **kwargs):
|
def get_auth_ref(self, session, **kwargs):
|
||||||
"""Stub this method for compatibility"""
|
# Stub this method for compatibility
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Override this because it needs to be a class method...
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_options(self):
|
def get_options(self):
|
||||||
options = super(TokenEndpoint, self).get_options()
|
options = super(TokenEndpoint, self).get_options()
|
||||||
|
Loading…
Reference in New Issue
Block a user