From f8eb17c59b6392d71c8e84a776ff5839087a8b46 Mon Sep 17 00:00:00 2001 From: sapd Date: Tue, 4 Dec 2018 18:38:42 +0700 Subject: [PATCH] Get scope token of current project when switch Keystone Provider Closes-Bug: #1806621 Change-Id: Ice5b56777967566770454bfbd6800bf3b8c57a37 --- openstack_auth/plugin/k2k.py | 3 ++- openstack_auth/views.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openstack_auth/plugin/k2k.py b/openstack_auth/plugin/k2k.py index 65afd62a8d..345bab60cf 100644 --- a/openstack_auth/plugin/k2k.py +++ b/openstack_auth/plugin/k2k.py @@ -70,7 +70,8 @@ class K2KAuthPlugin(base.BasePlugin): self, unscoped_idp_auth) try: scoped_idp_auth, __ = self.get_project_scoped_auth( - unscoped_idp_auth, unscoped_auth_ref) + unscoped_idp_auth, unscoped_auth_ref, + recent_project=kwargs['recent_project']) except exceptions.KeystoneAuthException as idp_excp: idp_exception = idp_excp diff --git a/openstack_auth/views.py b/openstack_auth/views.py index abd2f40ae7..c6d10ef21d 100644 --- a/openstack_auth/views.py +++ b/openstack_auth/views.py @@ -292,6 +292,7 @@ def switch_keystone_provider(request, keystone_provider=None, base_token = request.session.get('k2k_base_unscoped_token', None) k2k_auth_url = request.session.get('k2k_auth_url', None) keystone_providers = request.session.get('keystone_providers', None) + recent_project = request.COOKIES.get('recent_project') if not base_token or not k2k_auth_url: msg = _('K2K Federation not setup for this session') @@ -316,7 +317,7 @@ def switch_keystone_provider(request, keystone_provider=None, unscoped_auth = current_plugin.get_plugin( auth_url=k2k_auth_url, service_provider=keystone_provider, - plugins=plugins, token=base_token) + plugins=plugins, token=base_token, recent_project=recent_project) try: # Switch to identity provider using token auth