Derive splink when registering SP, allow visible = True in SP portal
authorRob Crittenden <rcritten@redhat.com>
Fri, 4 Sep 2015 15:37:09 +0000 (11:37 -0400)
committerPatrick Uiterwijk <puiterwijk@redhat.com>
Fri, 4 Sep 2015 16:44:39 +0000 (18:44 +0200)
The splink value wasn't being passed when registering a new client.
We don't need to prompt for this since we know it already

Accept 'True' as a value for visible when determining if we
should show a provider on the SP portal page.

https://fedorahosted.org/ipsilon/ticket/148

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ipsilon/install/ipsilon-client-install
templates/index.html

index 668cd58..44c3df3 100755 (executable)
@@ -153,12 +153,14 @@ def saml2():
                 logger.error("Failed to read SP Image file!\n" +
                              "Error: [%s]" % e)
 
+        sp_link = 'https://%s%s' % (args['hostname'], args['saml_auth'])
+
         # Register the SP
         try:
             saml2_register_sp(args['saml_idp_url'], args['admin_user'],
                               admin_password, args['saml_sp_name'],
                               sp_metadata, args['saml_sp_description'],
-                              args['saml_sp_visible'], sp_image)
+                              args['saml_sp_visible'], sp_image, sp_link)
         except Exception as e:  # pylint: disable=broad-except
             logger.error("Failed to register SP with IDP!\n" +
                          "Error: [%s]" % e)
@@ -225,7 +227,7 @@ def saml2():
 
 
 def saml2_register_sp(url, user, password, sp_name, sp_metadata,
-                      sp_description, sp_visible, sp_image):
+                      sp_description, sp_visible, sp_image, sp_link):
     s = requests.Session()
 
     # Authenticate to the IdP
@@ -253,6 +255,7 @@ def saml2_register_sp(url, user, password, sp_name, sp_metadata,
     if sp_image:
         if sp_image:
             sp_data['imagefile'] = sp_image
+    sp_data['splink'] = sp_link
     sp_data = urlencode(sp_data)
 
     r = s.post(sp_url, headers=sp_headers, data=sp_data)
index cf54fc4..db1339b 100644 (file)
@@ -86,7 +86,7 @@
 
       <div class="row thumbnails providers" id="providers">
       {% for p in providers %}
-        {% if p.visible == '1' %}
+        {% if (p.visible == '1') or (p.visible == 'True') %}
         <div class="col-sm-4 col-md-3 provider">
           <a
              {% if p.splink or 0 %}