Skip to content

Commit 335d586

Browse files
onovyAlistair Coles
authored andcommitted
Keystone middleware deprecated option is_admin removed
It has been deprecated from Swift 1.8.0 (Grizzly) Change-Id: Id6bc10c3e84262c0a9e6160a76af03c0ad363e9c
1 parent e6c28c4 commit 335d586

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

doc/manpages/proxy-server.conf.5

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,6 @@ This allows middleware higher in the WSGI pipeline to override auth
330330
processing, useful for middleware such as tempurl and formpost. If you know
331331
you're not going to use such middleware and you want a bit of extra security,
332332
you can set this to false.
333-
.IP \fBis_admin\fR
334-
[DEPRECATED] If is_admin is true, a user whose username is the same as the project name
335-
and who has any role on the project will have access rights elevated to be
336-
the same as if the user had an operator role. Note that the condition
337-
compares names rather than UUIDs. This option is deprecated.
338333
.IP \fBservice_roles\fR
339334
If the service_roles parameter is present, an X-Service-Token must be
340335
present in the request that when validated, grants at least one role listed

etc/proxy-server.conf-sample

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,6 @@ user_test5_tester5 = testing5 service
337337
# you can set this to false.
338338
# allow_overrides = true
339339
#
340-
# If is_admin is true, a user whose username is the same as the project name
341-
# and who has any role on the project will have access rights elevated to be
342-
# the same as if the user had an operator role. Note that the condition
343-
# compares names rather than UUIDs. This option is deprecated.
344-
# is_admin = false
345-
#
346340
# If the service_roles parameter is present, an X-Service-Token must be
347341
# present in the request that when validated, grants at least one role listed
348342
# in the parameter. The X-Service-Token may be scoped to any project.

swift/common/middleware/keystoneauth.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ class KeystoneAuth(object):
7575
id.. For example, if the project id is ``1234``, the path is
7676
``/v1/AUTH_1234``.
7777
78-
If the ``is_admin`` option is ``true``, a user whose username is the same
79-
as the project name and who has any role on the project will have access
80-
rights elevated to be the same as if the user had one of the
81-
``operator_roles``. Note that the condition compares names rather than
82-
UUIDs. This option is deprecated. It is ``false`` by default.
83-
8478
If you need to have a different reseller_prefix to be able to
8579
mix different auth servers you can configure the option
8680
``reseller_prefix`` in your keystoneauth entry like this::
@@ -188,7 +182,11 @@ def __init__(self, app, conf):
188182
self.reseller_admin_role = conf.get('reseller_admin_role',
189183
'ResellerAdmin').lower()
190184
config_is_admin = conf.get('is_admin', "false").lower()
191-
self.is_admin = swift_utils.config_true_value(config_is_admin)
185+
if swift_utils.config_true_value(config_is_admin):
186+
self.logger.warning("The 'is_admin' option for keystoneauth is no "
187+
"longer supported. Remove the 'is_admin' "
188+
"option from your keystoneauth config")
189+
192190
config_overrides = conf.get('allow_overrides', 't').lower()
193191
self.allow_overrides = swift_utils.config_true_value(config_overrides)
194192
self.default_domain_id = conf.get('default_domain_id', 'default')
@@ -484,14 +482,6 @@ def authorize(self, env_identity, req):
484482
req.environ['swift_owner'] = True
485483
return
486484

487-
# If user is of the same name of the tenant then make owner of it.
488-
if self.is_admin and user_name == tenant_name:
489-
self.logger.warning("the is_admin feature has been deprecated "
490-
"and will be removed in the future "
491-
"update your config file")
492-
req.environ['swift_owner'] = True
493-
return
494-
495485
if acl_authorized is not None:
496486
return self.denied_response(req)
497487

test/unit/common/middleware/test_keystoneauth.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -647,21 +647,16 @@ def test_authorize_succeeds_as_owner_for_insensitive_operator_role(self):
647647
req = self._check_authenticate(identity=identity)
648648
self.assertTrue(req.environ.get('swift_owner'))
649649

650-
def _check_authorize_for_tenant_owner_match(self, exception=None):
650+
def test_authorize_fails_same_user_and_tenant(self):
651+
# Historically the is_admin option allowed access when user_name
652+
# matched tenant_name, but it is no longer supported. This test is a
653+
# sanity check that the option no longer works.
654+
self.test_auth.is_admin = True
651655
identity = self._get_identity(user_name='same_name',
652656
tenant_name='same_name')
653-
req = self._check_authenticate(identity=identity, exception=exception)
654-
expected = bool(exception is None)
655-
self.assertEqual(bool(req.environ.get('swift_owner')), expected)
656-
657-
def test_authorize_succeeds_as_owner_for_tenant_owner_match(self):
658-
self.test_auth.is_admin = True
659-
self._check_authorize_for_tenant_owner_match()
660-
661-
def test_authorize_fails_as_owner_for_tenant_owner_match(self):
662-
self.test_auth.is_admin = False
663-
self._check_authorize_for_tenant_owner_match(
664-
exception=HTTP_FORBIDDEN)
657+
req = self._check_authenticate(identity=identity,
658+
exception=HTTP_FORBIDDEN)
659+
self.assertFalse(bool(req.environ.get('swift_owner')))
665660

666661
def test_authorize_succeeds_for_container_sync(self):
667662
env = {'swift_sync_key': 'foo', 'REMOTE_ADDR': '127.0.0.1'}

0 commit comments

Comments
 (0)