Add tests for project users interacting with endpoint_groups
This commit introduces some tests that show how project users are expected to behave with the endpoint_groups API. Change-Id: I0f32de4ea615c89a7500a8098c44ef543fe45a02 Closes-bug: #1818734
This commit is contained in:
parent
9011220178
commit
cf572f9e84
@ -575,3 +575,71 @@ class DomainUserTests(base_classes.TestCaseWithBootstrap,
|
||||
r = c.post('/v3/auth/tokens', json=auth)
|
||||
self.token_id = r.headers['X-Subject-Token']
|
||||
self.headers = {'X-Auth-Token': self.token_id}
|
||||
|
||||
|
||||
class ProjectUserTests(base_classes.TestCaseWithBootstrap,
|
||||
common_auth.AuthTestMixin,
|
||||
_DomainAndProjectUserEndpointGroupTests):
|
||||
|
||||
def setUp(self):
|
||||
super(ProjectUserTests, self).setUp()
|
||||
self.loadapp()
|
||||
self.useFixture(ksfixtures.Policy(self.config_fixture))
|
||||
self.config_fixture.config(group='oslo_policy', enforce_scope=True)
|
||||
|
||||
self.user_id = self.bootstrapper.admin_user_id
|
||||
auth = self.build_authentication_request(
|
||||
user_id=self.user_id,
|
||||
password=self.bootstrapper.admin_password,
|
||||
project_id=self.bootstrapper.project_id
|
||||
)
|
||||
|
||||
# Grab a token using the persona we're testing and prepare headers
|
||||
# for requests we'll be making in the tests.
|
||||
with self.test_client() as c:
|
||||
r = c.post('/v3/auth/tokens', json=auth)
|
||||
self.token_id = r.headers['X-Subject-Token']
|
||||
self.headers = {'X-Auth-Token': self.token_id}
|
||||
|
||||
|
||||
class ProjectUserTestsWithoutEnforceScope(
|
||||
base_classes.TestCaseWithBootstrap,
|
||||
common_auth.AuthTestMixin,
|
||||
_DomainAndProjectUserEndpointGroupTests):
|
||||
|
||||
def setUp(self):
|
||||
super(ProjectUserTestsWithoutEnforceScope, self).setUp()
|
||||
self.loadapp()
|
||||
self.useFixture(ksfixtures.Policy(self.config_fixture))
|
||||
|
||||
# Explicityly set enforce_scope to False to make sure we maintain
|
||||
# backwards compatibility with project users.
|
||||
self.config_fixture.config(group='oslo_policy', enforce_scope=False)
|
||||
|
||||
domain = PROVIDERS.resource_api.create_domain(
|
||||
uuid.uuid4().hex, unit.new_domain_ref()
|
||||
)
|
||||
user = unit.new_user_ref(domain_id=domain['id'])
|
||||
self.user_id = PROVIDERS.identity_api.create_user(user)['id']
|
||||
|
||||
self.project_id = PROVIDERS.resource_api.create_project(
|
||||
uuid.uuid4().hex, unit.new_project_ref(domain_id=domain['id'])
|
||||
)['id']
|
||||
|
||||
PROVIDERS.assignment_api.create_grant(
|
||||
self.bootstrapper.member_role_id, user_id=self.user_id,
|
||||
project_id=self.project_id
|
||||
)
|
||||
|
||||
auth = self.build_authentication_request(
|
||||
user_id=self.user_id,
|
||||
password=user['password'],
|
||||
project_id=self.project_id
|
||||
)
|
||||
|
||||
# Grab a token using the persona we're testing and prepare headers
|
||||
# for requests we'll be making in the tests.
|
||||
with self.test_client() as c:
|
||||
r = c.post('/v3/auth/tokens', json=auth)
|
||||
self.token_id = r.headers['X-Subject-Token']
|
||||
self.headers = {'X-Auth-Token': self.token_id}
|
||||
|
57
releasenotes/notes/bug-1818734-d753bfae60ffd030.yaml
Normal file
57
releasenotes/notes/bug-1818734-d753bfae60ffd030.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
[`bug 1818734 <https://bugs.launchpad.net/keystone/+bug/1818734>`_]
|
||||
The endpoint groups API now supports the ``admin``, ``member``, and
|
||||
``reader`` default roles.
|
||||
|
||||
upgrade:
|
||||
- |
|
||||
[`bug 1818734 <https://bugs.launchpad.net/keystone/+bug/1818734>`_]
|
||||
The endpoint groups API uses new default policies to make it more
|
||||
accessible to end users and administrators in a secure way. Please
|
||||
consider these new defaults if your deployment overrides endpoint
|
||||
groups policies.
|
||||
deprecations:
|
||||
- |
|
||||
[`bug 1818734 <https://bugs.launchpad.net/keystone/+bug/1818734>`_]
|
||||
The endpoint groups policies have been deprecated. The
|
||||
``identity:list_endpoint_groups`` policy now uses
|
||||
``role:reader and system_scope:all`` instead of
|
||||
``rule:admin_required``. The ``identity:get_endpoint_group`` policy
|
||||
now uses ``role:reader and system_scope:all`` instead of
|
||||
``rule:admin_required``. The ``identity:update_endpoint_group`` policy
|
||||
now use ``role:admin and system_scope:all`` instead of
|
||||
``rule:admin_required``.The ``identity:create_endpoint_group`` policy
|
||||
now use ``role:admin and system_scope:all`` instead of
|
||||
``rule:admin_required``. The ``identity:delete_endpoint_group`` policy
|
||||
now use ``role:admin and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
The ``identity:list_projects_associated_with_endpoint_group`` policy
|
||||
now uses ``role:reader and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
The ``identity:get_endpoint_group_in_project`` policy
|
||||
now uses ``role:reader and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
The ``identity:list_endpoints_associated_with_endpoint_group`` policy
|
||||
now uses ``role:reader and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
The ``identity:list_endpoint_groups_for_project`` policy
|
||||
now uses ``role:reader and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
The ``identity:add_endpoint_group_to_project`` policy
|
||||
now use ``role:admin and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
The ``identity:remove_endpoint_group_from_project`` policy
|
||||
now use ``role:admin and system_scope:all`` instead of
|
||||
``rule:admin_required``.
|
||||
These new defaults automatically account for system-scope and support
|
||||
a read-only role, making it easier for system administrators to delegate
|
||||
subsets of responsibility without compromising security. Please consider
|
||||
these new defaults if your deployment overrides the endpoint group
|
||||
policies.
|
||||
security:
|
||||
- |
|
||||
[`bug 1818734 <https://bugs.launchpad.net/keystone/+bug/1818734>`_]
|
||||
The endpoint group API now uses system-scope and default roles
|
||||
to provide better accessibility to users in a secure manner.
|
Loading…
x
Reference in New Issue
Block a user