Skip to content

Commit eed615e

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove token_endpoint auth type"
2 parents fd63a90 + 6fcc260 commit eed615e

8 files changed

Lines changed: 40 additions & 105 deletions

File tree

doc/source/cli/authentication.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ There are at least three authentication types that are always available:
3939
(described below as token/endpoint) in that a token and an authentication
4040
URL are supplied and the plugin retrieves a new token.
4141
[Required: ``--os-auth-url``, ``--os-token``]
42-
* **Token/Endpoint**: This is the original token authentication (known as 'token
43-
flow' in the early CLI documentation in the OpenStack wiki). It requires
44-
a token and a direct endpoint that is used in the API call. The difference
45-
from the new Token type is this token is used as-is, no call is made
46-
to the Identity service from the client. This type is most often used to
47-
bootstrap a Keystone server where the token is the ``admin_token`` configured
48-
in ``keystone.conf``. It will also work with other services and a regular
49-
scoped token such as one obtained from a ``token issue`` command.
50-
[Required: ``--os-url``, ``--os-token``]
5142
* **Others**: Other authentication plugins such as SAML, Kerberos, and OAuth1.0
5243
are under development and also supported. To use them, they must be selected
5344
by supplying the ``--os-auth-type`` option.

doc/source/cli/backwards-incompatible.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ Release 4.0
9696
* Removed in: 4.0
9797
* Commit: https://review.opendev.org/612751
9898

99+
14. Remove 'Token/Endpoint' auth plugin support (type ``token_endpoint``).
100+
This remained as a compatibility for the ``admin_token`` auth type to
101+
support the ``--url`` global option. That option is also now removed,
102+
use ``--endpoint`` instead.
103+
104+
* Removed in: 4.0
105+
* Commit: https://review.opendev.org/<tbd>
106+
99107
Release 3.12
100108
------------
101109

openstackclient/api/auth_plugin.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

openstackclient/shell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ def build_option_parser(self, description, version):
5858
def _final_defaults(self):
5959
super(OpenStackShell, self)._final_defaults()
6060

61-
# Set the default plugin to token_endpoint if url and token are given
62-
if (self.options.url and self.options.token):
63-
# Use service token authentication
64-
self._auth_type = 'token_endpoint'
61+
# Set the default plugin to admin_token if endpoint and token are given
62+
if (self.options.endpoint and self.options.token):
63+
# Use token authentication
64+
self._auth_type = 'admin_token'
6565
else:
6666
self._auth_type = 'password'
6767

openstackclient/tests/functional/common/test_args.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
import json
1414

15+
from tempest.lib import exceptions as tempest_exc
16+
1517
from openstackclient.tests.functional import base
1618

1719

@@ -49,19 +51,17 @@ def test_auth_type_none(self):
4951
)
5052

5153
def test_auth_type_token_endpoint_opt(self):
52-
cmd_output = json.loads(self.openstack(
53-
'configuration show -f json --os-auth-type token_endpoint',
54-
cloud=None,
55-
))
56-
self.assertIsNotNone(cmd_output)
57-
self.assertIn(
58-
'auth_type',
59-
cmd_output.keys(),
60-
)
61-
self.assertEqual(
62-
'token_endpoint',
63-
cmd_output['auth_type'],
64-
)
54+
# Make sure token_endpoint is really gone
55+
try:
56+
self.openstack(
57+
'configuration show -f json --os-auth-type token_endpoint',
58+
cloud=None,
59+
)
60+
except tempest_exc.CommandFailed as e:
61+
self.assertIn('--os-auth-type: invalid choice:', str(e))
62+
self.assertIn('token_endpoint', str(e))
63+
else:
64+
self.fail('CommandFailed should be raised')
6565

6666
def test_auth_type_password_opt(self):
6767
cmd_output = json.loads(self.openstack(

openstackclient/tests/unit/common/test_clientmanager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ def _clientmanager_class(self):
2828
"""Allow subclasses to override the ClientManager class"""
2929
return clientmanager.ClientManager
3030

31-
def test_client_manager_token_endpoint(self):
31+
def test_client_manager_admin_token(self):
3232
token_auth = {
33-
'url': fakes.AUTH_URL,
33+
'endpoint': fakes.AUTH_URL,
3434
'token': fakes.AUTH_TOKEN,
3535
}
3636
client_manager = self._make_clientmanager(
3737
auth_args=token_auth,
38-
auth_plugin_name='token_endpoint',
38+
auth_plugin_name='admin_token',
3939
)
4040

4141
self.assertEqual(
4242
fakes.AUTH_URL,
43-
client_manager._cli_options.config['auth']['url'],
43+
client_manager._cli_options.config['auth']['endpoint'],
4444
)
4545
self.assertEqual(
4646
fakes.AUTH_TOKEN,

openstackclient/tests/unit/test_shell.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def setUp(self):
153153
# released in osc-lib
154154
self.shell_class = importutils.import_class(self.shell_class_name)
155155

156-
def _assert_token_endpoint_auth(self, cmd_options, default_args):
156+
def _assert_admin_token_auth(self, cmd_options, default_args):
157157
with mock.patch(
158158
self.shell_class_name + ".initialize_app",
159159
self.app,
@@ -172,9 +172,9 @@ def _assert_token_endpoint_auth(self, cmd_options, default_args):
172172
"token",
173173
)
174174
self.assertEqual(
175-
default_args.get("url", ''),
176-
_shell.options.url,
177-
"url",
175+
default_args.get("endpoint", ''),
176+
_shell.options.endpoint,
177+
"endpoint",
178178
)
179179

180180
def _assert_token_auth(self, cmd_options, default_args):
@@ -338,31 +338,31 @@ def setUp(self):
338338
super(TestShellTokenEndpointAuthEnv, self).setUp()
339339
env = {
340340
"OS_TOKEN": DEFAULT_TOKEN,
341-
"OS_URL": DEFAULT_SERVICE_URL,
341+
"OS_ENDPOINT": DEFAULT_SERVICE_URL,
342342
}
343343
self.useFixture(osc_lib_test_utils.EnvFixture(env.copy()))
344344

345345
def test_env(self):
346346
flag = ""
347347
kwargs = {
348348
"token": DEFAULT_TOKEN,
349-
"url": DEFAULT_SERVICE_URL,
349+
"endpoint": DEFAULT_SERVICE_URL,
350350
}
351-
self._assert_token_endpoint_auth(flag, kwargs)
351+
self._assert_admin_token_auth(flag, kwargs)
352352

353353
def test_only_token(self):
354354
flag = "--os-token xyzpdq"
355355
kwargs = {
356356
"token": "xyzpdq",
357-
"url": DEFAULT_SERVICE_URL,
357+
"endpoint": DEFAULT_SERVICE_URL,
358358
}
359359
self._assert_token_auth(flag, kwargs)
360360

361361
def test_only_url(self):
362-
flag = "--os-url http://cloud.local:555"
362+
flag = "--os-endpoint http://cloud.local:555"
363363
kwargs = {
364364
"token": DEFAULT_TOKEN,
365-
"url": "http://cloud.local:555",
365+
"endpoint": "http://cloud.local:555",
366366
}
367367
self._assert_token_auth(flag, kwargs)
368368

@@ -371,7 +371,7 @@ def test_empty_auth(self):
371371
flag = ""
372372
kwargs = {
373373
"token": '',
374-
"url": '',
374+
"endpoint": '',
375375
}
376376
self._assert_token_auth(flag, kwargs)
377377

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ packages =
2727
console_scripts =
2828
openstack = openstackclient.shell:main
2929

30-
keystoneauth1.plugin =
31-
token_endpoint = openstackclient.api.auth_plugin:TokenEndpoint
32-
3330
openstack.cli =
3431
command_list = openstackclient.common.module:ListCommand
3532
module_list = openstackclient.common.module:ListModule

0 commit comments

Comments
 (0)