Merge "Keystone to Keystone Federation Drop Down"

This commit is contained in:
Jenkins 2017-01-25 23:10:07 +00:00 committed by Gerrit Code Review
commit 8201d7bc9f
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

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

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>`_].