summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kolodyazhny <e0ne@e0ne.info>2020-04-08 13:23:29 +0300
committerIvan Kolodyazhny <e0ne@e0ne.info>2020-04-09 09:19:47 +0000
commit086c6607ef7834c308dcc58e74349293b7685ac1 (patch)
treeccde3d38a3329cbb3364603faafbaacf974f4283
parent63cf09e07ead9f6810f2a850f29cf47da3ffae2e (diff)
downloadhorizon-086c6607ef7834c308dcc58e74349293b7685ac1.tar.gz
Add auth_type to template context for openrc file rendering
We need to path auth_type value to the template because different templates could be rendered for credentials and websso auth_type. Closes-Bug: #1871806 Change-Id: If218813e0b4a8cc51c4e590081c5f3c50b35b8a7
-rw-r--r--openstack_auth/user.py1
-rw-r--r--openstack_auth/views.py1
-rw-r--r--openstack_dashboard/dashboards/project/api_access/views.py1
3 files changed, 3 insertions, 0 deletions
diff --git a/openstack_auth/user.py b/openstack_auth/user.py
index 94f3385f2..4971a2adf 100644
--- a/openstack_auth/user.py
+++ b/openstack_auth/user.py
@@ -39,6 +39,7 @@ def unset_session_user_variables(request):
request.session['user_id'] = None
request.session['region_endpoint'] = None
request.session['services_region'] = None
+ request.session['auth_type'] = None
# Update the user object cached in the request
request._cached_user = None
request.user = None
diff --git a/openstack_auth/views.py b/openstack_auth/views.py
index 571b0e381..54f0ed881 100644
--- a/openstack_auth/views.py
+++ b/openstack_auth/views.py
@@ -69,6 +69,7 @@ def login(request):
# from the dropdown, We need to redirect user to the websso url
if request.method == 'POST':
auth_type = request.POST.get('auth_type', 'credentials')
+ request.session['auth_type'] = auth_type
if utils.is_websso_enabled() and auth_type != 'credentials':
region_id = request.POST.get('region')
auth_url = getattr(settings, 'WEBSSO_KEYSTONE_URL', None)
diff --git a/openstack_dashboard/dashboards/project/api_access/views.py b/openstack_dashboard/dashboards/project/api_access/views.py
index d2d32f436..ab4fa9d36 100644
--- a/openstack_dashboard/dashboards/project/api_access/views.py
+++ b/openstack_dashboard/dashboards/project/api_access/views.py
@@ -80,6 +80,7 @@ def _get_openrc_credentials(request):
'user': request.user,
'interface': 'public',
'os_endpoint_type': 'publicURL',
+ 'auth_type': request.session.get('auth_type'),
'region': getattr(request.user, 'services_region') or "",
}