Merge "Fix token/endpoint auth plugin"
This commit is contained in:
commit
fd03f5250a
@ -15,50 +15,55 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from oslo_config import cfg
|
from keystoneauth1 import loading
|
||||||
from six.moves.urllib import parse as urlparse
|
|
||||||
|
|
||||||
from keystoneauth1.loading._plugins import admin_token as token_endpoint
|
|
||||||
from keystoneauth1.loading._plugins.identity import generic as ksa_password
|
from keystoneauth1.loading._plugins.identity import generic as ksa_password
|
||||||
|
from keystoneauth1 import token_endpoint
|
||||||
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from openstackclient.i18n import _
|
from openstackclient.i18n import _
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TokenEndpoint(token_endpoint.AdminToken):
|
class TokenEndpoint(loading.BaseLoader):
|
||||||
"""Auth plugin to handle traditional token/endpoint usage
|
"""Auth plugin to handle traditional token/endpoint usage
|
||||||
|
|
||||||
Implements the methods required to handle token authentication
|
Keystoneauth contains a Token plugin class that now correctly
|
||||||
with a user-specified token and service endpoint; no Identity calls
|
handles the token/endpoint auth compatible with OSC. However,
|
||||||
are made for re-scoping, service catalog lookups or the like.
|
the AdminToken loader deprecates the 'url' argument, which breaks
|
||||||
|
OSC compatibility, so make one that works.
|
||||||
The purpose of this plugin is to get rid of the special-case paths
|
|
||||||
in the code to handle this authentication format. Its primary use
|
|
||||||
is for bootstrapping the Keystone database.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def plugin_class(self):
|
||||||
|
return token_endpoint.Token
|
||||||
|
|
||||||
def load_from_options(self, url, token, **kwargs):
|
def load_from_options(self, url, token, **kwargs):
|
||||||
"""A plugin for static authentication with an existing token
|
"""A plugin for static authentication with an existing token
|
||||||
|
|
||||||
:param string url: Service endpoint
|
:param string url: Service endpoint
|
||||||
:param string token: Existing token
|
:param string token: Existing token
|
||||||
"""
|
"""
|
||||||
return super(TokenEndpoint, self).load_from_options(endpoint=url,
|
|
||||||
token=token)
|
return super(TokenEndpoint, self).load_from_options(
|
||||||
|
endpoint=url,
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
|
||||||
def get_options(self):
|
def get_options(self):
|
||||||
options = super(TokenEndpoint, self).get_options()
|
"""Return the legacy options"""
|
||||||
|
|
||||||
options.extend([
|
options = [
|
||||||
# Maintain name 'url' for compatibility
|
loading.Opt(
|
||||||
cfg.StrOpt('url',
|
'url',
|
||||||
help=_('Specific service endpoint to use')),
|
help=_('Specific service endpoint to use'),
|
||||||
cfg.StrOpt('token',
|
),
|
||||||
|
loading.Opt(
|
||||||
|
'token',
|
||||||
secret=True,
|
secret=True,
|
||||||
help=_('Authentication token to use')),
|
help=_('Authentication token to use'),
|
||||||
])
|
),
|
||||||
|
]
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user