1 From cb5040934c3132dbddbb5c24d45f76d2f4fbc062 Mon Sep 17 00:00:00 2001
2 From: lin-hua-cheng <os.lcheng@gmail.com>
3 Date: Wed, 15 Jul 2015 11:13:38 -0700
4 Subject: [PATCH] Use unscoped token for scoping to project
6 When authenticating a user in v3, always request
7 for an unscoped token. Otherwise it would automatically
8 default to the default project.
10 Change-Id: I9e1d9129e2fb35933c803096fca9f1236affc27f
12 (cherry picked from commit e4062e37069d58814b7c09299d3018297a75ba1d)
14 openstack_auth/backend.py | 8 +++-----
15 openstack_auth/plugin/password.py | 3 ++-
16 openstack_auth/tests/tests.py | 3 ++-
17 3 files changed, 7 insertions(+), 7 deletions(-)
19 diff --git a/openstack_auth/backend.py b/openstack_auth/backend.py
20 index 46c32d4..3859638 100644
21 --- a/openstack_auth/backend.py
22 +++ b/openstack_auth/backend.py
23 @@ -138,11 +138,9 @@ class KeystoneBackend(object):
24 request = kwargs.get('request')
27 - # Check if token is automatically scoped to default_project
28 - # grab the project from this token, to use as a default
29 - # if no recent_project is found in the cookie
30 - recent_project = request.COOKIES.get('recent_project',
31 - unscoped_auth_ref.project_id)
32 + # Grab recent_project found in the cookie, try to scope
33 + # to the last project used.
34 + recent_project = request.COOKIES.get('recent_project')
36 # if a most recent project was found, try using it first
38 diff --git a/openstack_auth/plugin/password.py b/openstack_auth/plugin/password.py
39 index 484adc2..4143f25 100644
40 --- a/openstack_auth/plugin/password.py
41 +++ b/openstack_auth/plugin/password.py
42 @@ -42,7 +42,8 @@ class PasswordPlugin(base.BasePlugin):
43 return v3_auth.Password(auth_url=auth_url,
46 - user_domain_name=user_domain_name)
47 + user_domain_name=user_domain_name,
51 return v2_auth.Password(auth_url=auth_url,
52 diff --git a/openstack_auth/tests/tests.py b/openstack_auth/tests/tests.py
53 index 09bdc76..467f814 100644
54 --- a/openstack_auth/tests/tests.py
55 +++ b/openstack_auth/tests/tests.py
56 @@ -496,7 +496,8 @@ class OpenStackAuthTestsV3(OpenStackAuthTestsMixin, test.TestCase):
57 return auth_v3.Password(auth_url=url,
60 - user_domain_name=DEFAULT_DOMAIN)
61 + user_domain_name=DEFAULT_DOMAIN,
64 def _create_token_auth(self, project_id, token=None, url=None):