Keystone to Keystone Federation Drop Down

This adds a dropdown to enable the user to switch Keystone providers using
Keystone to Keystone Federation.

Depends-On: I75b1a10a3b40b5544b60f6fdc060e0070c585977
Change-Id: Id39bf8d21c537347cbd23f63eaa3da8cc1bfff46
Implements: blueprint k2k-horizon
This commit is contained in:
Elvin Tubillara 2016-08-31 17:11:31 -05:00
parent 49fa842da8
commit 69eb05ae71
6 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,20 @@
{% load i18n %}
{% if keystone_providers.support %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="keystone-provider-title">{{ keystone_providers.current.name }}</span>
<span class="fa fa-caret-down"></span>
</a>
<ul id="keystone_provider_list" class="dropdown-menu dropdown-menu-right">
<li class="dropdown-header">{% trans "Keystone Providers:" %}</li>
{% for provider in keystone_providers.available %}
<li>
<a href="{% url 'switch_keystone_provider' provider.id %}?keystone_provider={{ provider.id|urlencode }}">
<span class="region-name dropdown-title">{{ provider.name }}</span>
{% if provider.name == keystone_providers.current.name %}
<span class="fa fa-check"></span>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}

View File

@ -55,6 +55,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

View File

@ -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

View File

@ -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" %}
</ul>

View File

@ -0,0 +1,11 @@
{% if not_list %}
<div class="dropdown">
{% else %}
<li class="dropdown">
{% endif %}
{% include "horizon/common/_keystone_provider_selector.html" %}
{% if not_list %}
</div>
{% else %}
</li>
{% endif %}

View File

@ -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
<https://blueprints.launchpad.net/horizon/+spec/k2k-horizon>`_].