WebSSO support for Horizon

Change-Id: I47619663c107011a9dc30eba6bf554b7ce63d69a
diff --git a/README.rst b/README.rst
index a486264..18da802 100644
--- a/README.rst
+++ b/README.rst
@@ -352,6 +352,20 @@
               address: https://github.com/openstack/horizon.git
               rev: stable/juno
 
+Enable WebSSO feature
+
+.. code-block:: yaml
+
+    horizon:
+      server:
+        enabled: true
+        websso:
+          login_url: "WEBROOT + 'auth/login/'"
+          logout_url: "WEBROOT + 'auth/logout/'"
+          websso_choices:
+            - saml2
+            - oidc
+
 Read more
 =========
 
diff --git a/horizon/files/horizon_settings/_websso_settings.py b/horizon/files/horizon_settings/_websso_settings.py
new file mode 100644
index 0000000..592b650
--- /dev/null
+++ b/horizon/files/horizon_settings/_websso_settings.py
@@ -0,0 +1,24 @@
+{%- from "horizon/map.jinja" import server with context %}
+{%- if server.websso is defined %}
+{%- if server.websso.login_url is defined %}
+LOGIN_URL = {{ server.websso.login_url }}
+{%- endif %}
+
+{%- if server.websso.logout_url is defined %}
+LOGOUT_URL = {{ server.websso.logout_url }}
+{%- endif %}
+
+WEBSSO_ENABLED = True
+
+WEBSSO_CHOICES = (
+    ("credentials", _("Keystone Credentials")),
+    {%- if 'oidc' in server.websso.websso_choices %}
+    ("oidc", _("OpenID Connect")),
+    {%- endif %}
+    {%- if 'saml2' in server.websso.websso_choices %}
+    ("saml2", _("Security Assertion Markup Language")),
+    {%- endif %}
+)
+
+WEBSSO_INITIAL_CHOICE = "credentials"
+{%- endif %}
diff --git a/horizon/files/local_settings/juno_settings.py b/horizon/files/local_settings/juno_settings.py
index 67c1657..446408a 100644
--- a/horizon/files/local_settings/juno_settings.py
+++ b/horizon/files/local_settings/juno_settings.py
@@ -75,3 +75,4 @@
 {% include "horizon/files/horizon_settings/_nova_settings.py" %}
 {% include "horizon/files/horizon_settings/_glance_settings.py" %}
 {% include "horizon/files/horizon_settings/_neutron_settings.py" %}
+{% include "horizon/files/horizon_settings/_websso_settings.py" %}
diff --git a/horizon/files/local_settings/kilo_settings.py b/horizon/files/local_settings/kilo_settings.py
index 0f14217..5491390 100644
--- a/horizon/files/local_settings/kilo_settings.py
+++ b/horizon/files/local_settings/kilo_settings.py
@@ -57,3 +57,4 @@
 {% include "horizon/files/horizon_settings/_nova_settings.py" %}
 {% include "horizon/files/horizon_settings/_glance_settings.py" %}
 {% include "horizon/files/horizon_settings/_neutron_settings.py" %}
+{% include "horizon/files/horizon_settings/_websso_settings.py" %}
diff --git a/horizon/files/local_settings/liberty_settings.py b/horizon/files/local_settings/liberty_settings.py
index 22e3a4d..fc422f8 100644
--- a/horizon/files/local_settings/liberty_settings.py
+++ b/horizon/files/local_settings/liberty_settings.py
@@ -62,3 +62,4 @@
 {% include "horizon/files/horizon_settings/_nova_settings.py" %}
 {% include "horizon/files/horizon_settings/_glance_settings.py" %}
 {% include "horizon/files/horizon_settings/_neutron_settings.py" %}
+{% include "horizon/files/horizon_settings/_websso_settings.py" %}
diff --git a/horizon/files/local_settings/mitaka_settings.py b/horizon/files/local_settings/mitaka_settings.py
index 22e3a4d..fc422f8 100644
--- a/horizon/files/local_settings/mitaka_settings.py
+++ b/horizon/files/local_settings/mitaka_settings.py
@@ -62,3 +62,4 @@
 {% include "horizon/files/horizon_settings/_nova_settings.py" %}
 {% include "horizon/files/horizon_settings/_glance_settings.py" %}
 {% include "horizon/files/horizon_settings/_neutron_settings.py" %}
+{% include "horizon/files/horizon_settings/_websso_settings.py" %}
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index 3eb9909..2ff2bd6 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -25,6 +25,12 @@
       host: 127.0.0.1
       port: 5000
       api_version: 2
+    websso:
+      login_url: "WEBROOT + 'auth/login/'"
+      logout_url: "WEBROOT + 'auth/logout/'"
+      websso_choices:
+        - saml2
+        - oidc
 haproxy:
   proxy:
     listens:
@@ -45,4 +51,4 @@
       - name: ctl03
         host: 127.0.0.1
         port: 80
-        params: cookie ctl03 check inter 2000 fall 3
\ No newline at end of file
+        params: cookie ctl03 check inter 2000 fall 3
diff --git a/tests/pillar/single.sls b/tests/pillar/single.sls
index 827cd88..f99cc0b 100644
--- a/tests/pillar/single.sls
+++ b/tests/pillar/single.sls
@@ -23,4 +23,10 @@
       port: 5000
       host: 127.0.0.1
       encryption: encryption
-      api_version: 2
\ No newline at end of file
+      api_version: 2
+    websso:
+      login_url: "WEBROOT + 'auth/login/'"
+      logout_url: "WEBROOT + 'auth/logout/'"
+      websso_choices:
+        - saml2
+        - oidc