Skip to content

Commit 5428e09

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Remove auth_with_unscoped_saml decorator"
2 parents b8f9768 + 5203cc9 commit 5428e09

2 files changed

Lines changed: 0 additions & 48 deletions

File tree

openstackclient/identity/v3/unscoped_saml.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,14 @@
1818
a scoped token."""
1919

2020
from osc_lib.command import command
21-
from osc_lib import exceptions
2221
from osc_lib import utils
2322

2423
from openstackclient.i18n import _
2524

2625

27-
UNSCOPED_AUTH_PLUGINS = ['v3unscopedsaml', 'v3unscopedadfs', 'v3oidc']
28-
29-
30-
def auth_with_unscoped_saml(func):
31-
"""Check the unscoped federated context"""
32-
33-
def _decorated(self, parsed_args):
34-
auth_plugin_name = self.app.client_manager.auth_plugin_name
35-
if auth_plugin_name in UNSCOPED_AUTH_PLUGINS:
36-
return func(self, parsed_args)
37-
else:
38-
msg = (_('This command requires the use of an unscoped SAML '
39-
'authentication plugin. Please use argument '
40-
'--os-auth-type with one of the following '
41-
'plugins: %s') % ', '.join(UNSCOPED_AUTH_PLUGINS))
42-
raise exceptions.CommandError(msg)
43-
return _decorated
44-
45-
4626
class ListAccessibleDomains(command.Lister):
4727
_description = _("List accessible domains")
4828

49-
@auth_with_unscoped_saml
5029
def take_action(self, parsed_args):
5130
columns = ('ID', 'Enabled', 'Name', 'Description')
5231
identity_client = self.app.client_manager.identity
@@ -61,7 +40,6 @@ def take_action(self, parsed_args):
6140
class ListAccessibleProjects(command.Lister):
6241
_description = _("List accessible projects")
6342

64-
@auth_with_unscoped_saml
6543
def take_action(self, parsed_args):
6644
columns = ('ID', 'Domain ID', 'Enabled', 'Name')
6745
identity_client = self.app.client_manager.identity

openstackclient/tests/unit/identity/v3/test_unscoped_saml.py

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

1313
import copy
1414

15-
from osc_lib import exceptions
16-
1715
from openstackclient.identity.v3 import unscoped_saml
1816
from openstackclient.tests.unit import fakes
1917
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
@@ -48,7 +46,6 @@ def setUp(self):
4846
self.cmd = unscoped_saml.ListAccessibleDomains(self.app, None)
4947

5048
def test_accessible_domains_list(self):
51-
self.app.client_manager.auth_plugin_name = 'v3unscopedsaml'
5249
arglist = []
5350
verifylist = []
5451
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -70,17 +67,6 @@ def test_accessible_domains_list(self):
7067
), )
7168
self.assertEqual(datalist, tuple(data))
7269

73-
def test_accessible_domains_list_wrong_auth(self):
74-
auth = identity_fakes.FakeAuth("wrong auth")
75-
self.app.client_manager.identity.session.auth = auth
76-
arglist = []
77-
verifylist = []
78-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
79-
80-
self.assertRaises(exceptions.CommandError,
81-
self.cmd.take_action,
82-
parsed_args)
83-
8470

8571
class TestProjectList(TestUnscopedSAML):
8672

@@ -99,7 +85,6 @@ def setUp(self):
9985
self.cmd = unscoped_saml.ListAccessibleProjects(self.app, None)
10086

10187
def test_accessible_projects_list(self):
102-
self.app.client_manager.auth_plugin_name = 'v3unscopedsaml'
10388
arglist = []
10489
verifylist = []
10590
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -120,14 +105,3 @@ def test_accessible_projects_list(self):
120105
identity_fakes.project_name,
121106
), )
122107
self.assertEqual(datalist, tuple(data))
123-
124-
def test_accessible_projects_list_wrong_auth(self):
125-
auth = identity_fakes.FakeAuth("wrong auth")
126-
self.app.client_manager.identity.session.auth = auth
127-
arglist = []
128-
verifylist = []
129-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
130-
131-
self.assertRaises(exceptions.CommandError,
132-
self.cmd.take_action,
133-
parsed_args)

0 commit comments

Comments
 (0)