diff options
author | Henry Nash <henryn@linux.vnet.ibm.com> | 2013-07-05 06:04:25 +0100 |
---|---|---|
committer | Henry Nash <henryn@linux.vnet.ibm.com> | 2013-07-10 05:23:00 +0100 |
commit | 661cef927e95cf87a96eea7f0f6d840f8bf4adcd (patch) | |
tree | 50762c60adead7c8c557696da8b70b2c87da6283 /tests/test_content_types.py | |
parent | fafdf072f5a34ee12ffe9d7651551c83459759bb (diff) | |
download | keystone-661cef927e95cf87a96eea7f0f6d840f8bf4adcd.tar.gz keystone-661cef927e95cf87a96eea7f0f6d840f8bf4adcd.tar.xz keystone-661cef927e95cf87a96eea7f0f6d840f8bf4adcd.zip |
Rationalize how we get roles after authentication in the controllers
Currently there is a mixture of strategies in the v2 and v3 controllers
for how to get the roles assigned for the scope of the requested
authentication. This duplicates code, is hard to maintain and in at
least once case (where your only roles on a project are due to a group
membership) is not actually correct (for v2 tokens).
This change does the following:
- Standardizes on using the 'get_roles_for_user_and_project()', and its
domain equivalent, for how roles are obtained to build a token. This
was already the case for v3 tokens. The controllers no longer need
to get metadata and extract the roles.
- Removes the driver level function to 'authorize_for_project' - this is
now handled wihin the controller. The driver simply supports the user
authentication.
A nice (and planned for) sideffect of the above is that we now hide
the schema of how we store roles within the driver layer - i.e.
nothing outside of the driver (other than any specific-to-implementation
tests) have to know about how roles are stored in the metadata. This paves
the way for a re-implementation of the grant tables in IceHouse.
This change also fills in missing function definitons in the assignment
driver.
Implements bp authenticate-role-rationalization
Change-Id: I75fc7f5f728649d40ab1c696b33bbcd88ea6edee
Diffstat (limited to 'tests/test_content_types.py')
-rw-r--r-- | tests/test_content_types.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/test_content_types.py b/tests/test_content_types.py index 820dc0dd..278a1098 100644 --- a/tests/test_content_types.py +++ b/tests/test_content_types.py @@ -70,14 +70,12 @@ class RestfulTestCase(test.TestCase): self.admin_app = webtest.TestApp( self.loadapp('keystone', name='admin')) - # TODO(termie): is_admin is being deprecated once the policy stuff - # is all working # TODO(termie): add an admin user to the fixtures and use that user # override the fixtures, for now - self.metadata_foobar = self.identity_api.update_metadata( + self.metadata_foobar = self.identity_api.add_role_to_user_and_project( self.user_foo['id'], self.tenant_bar['id'], - dict(roles=[self.role_admin['id']], is_admin='1')) + self.role_admin['id']) def tearDown(self): """Kill running servers and release references to avoid leaks.""" @@ -403,10 +401,10 @@ class CoreApiTests(object): self.assertValidAuthenticationResponse(r) def test_validate_token_service_role(self): - self.metadata_foobar = self.identity_api.update_metadata( + self.metadata_foobar = self.identity_api.add_role_to_user_and_project( self.user_foo['id'], self.tenant_service['id'], - dict(roles=[self.role_service['id']])) + self.role_service['id']) token = self.get_scoped_token(tenant_id='service') r = self.admin_request( |