diff --git a/horizon/templates/horizon/common/_keystone_provider_selector.html b/horizon/templates/horizon/common/_keystone_provider_selector.html new file mode 100644 index 0000000000..5fc2fa1603 --- /dev/null +++ b/horizon/templates/horizon/common/_keystone_provider_selector.html @@ -0,0 +1,20 @@ +{% load i18n %} +{% if keystone_providers.support %} + + +{% endif %} diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py index db3e482752..c673e9bdd7 100644 --- a/openstack_dashboard/context_processors.py +++ b/openstack_dashboard/context_processors.py @@ -56,6 +56,31 @@ def openstack(request): 'name': request.session.get('region_name')}, 'available': [{'endpoint': region[0], 'name':region[1]} for region in available_regions]} + + # K2K Federation Service Providers context/support + available_providers = request.session.get('keystone_providers', []) + if available_providers: + provider_id = request.session.get('keystone_provider_id', None) + provider_name = None + for provider in available_providers: + if provider['id'] == provider_id: + provider_name = provider.get('name') + + keystone_providers = { + 'support': len(available_providers) > 1, + 'current': { + 'name': provider_name, + 'id': provider_id + }, + 'available': [ + {'name': keystone_provider['name'], + 'id': keystone_provider['id']} + for keystone_provider in available_providers] + } + else: + keystone_providers = {'support': False} + + context['keystone_providers'] = keystone_providers context['regions'] = regions # Adding webroot access diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index 72483975c5..e7cfa2977b 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -196,6 +196,14 @@ OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_" # "acme_saml2": ("acme", "saml2"), #} +# The Keystone Provider drop down uses Keystone to Keystone federation +# to switch between Keystone service providers. +# Set display name for Identity Provider (dropdown display name) +#KEYSTONE_PROVIDER_IDP_NAME = "Local Keystone" +# This id is used for only for comparison with the service provider IDs. This ID +# should not match any service provider IDs. +#KEYSTONE_PROVIDER_IDP_ID = "localkeystone" + # Disable SSL certificate checks (useful for self-signed certificates): #OPENSTACK_SSL_NO_VERIFY = True diff --git a/openstack_dashboard/templates/header/_header.html b/openstack_dashboard/templates/header/_header.html index 88518eab77..c1aa83357b 100644 --- a/openstack_dashboard/templates/header/_header.html +++ b/openstack_dashboard/templates/header/_header.html @@ -32,6 +32,7 @@ {% if profiler_enabled %} {% include "developer/profiler/_mode_picker.html" %} {% endif %} + {% include "header/_keystone_provider_selection.html" %} {% include "header/_user_menu.html" %} {% include "header/_region_selection.html" %} diff --git a/openstack_dashboard/templates/header/_keystone_provider_selection.html b/openstack_dashboard/templates/header/_keystone_provider_selection.html new file mode 100644 index 0000000000..9737e0f88d --- /dev/null +++ b/openstack_dashboard/templates/header/_keystone_provider_selection.html @@ -0,0 +1,11 @@ +{% if not_list %} + +{% else %} + +{% endif %} \ No newline at end of file diff --git a/releasenotes/notes/bp-k2k-horizon-9577253d626337c1.yaml b/releasenotes/notes/bp-k2k-horizon-9577253d626337c1.yaml new file mode 100644 index 0000000000..ec90e72b83 --- /dev/null +++ b/releasenotes/notes/bp-k2k-horizon-9577253d626337c1.yaml @@ -0,0 +1,11 @@ +--- +features: + - Added Keystone to Keystone (K2K) federation support in Horizon. If Keystone + is configured with K2K and has service providers, the list of + Keystone providers will appear in a dropdown. In local_settings.py you can + optionally set the identity provider display name with + ``KEYSTONE_PROVIDER_IDP_NAME`` or set the provider id that is used to + compare with the other service providers ``KEYSTONE_PROVIDER_IDP_ID``. + + [`blueprint k2k-horizon + `_].