]> code.communitydata.science - nu-vpn-proxy.git/commitdiff
SAML auth isn't done until we've gotten the username and cookie headers specifically...
authorDaniel Lenski <dlenski@gmail.com>
Thu, 19 Sep 2019 21:01:51 +0000 (14:01 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 19 Sep 2019 21:02:42 +0000 (14:02 -0700)
gp-saml-gui.py

index 1f2b1b58663cf53aaea1f254eebe290ff9b5cd71..0bd42485db06ed1161454d3f3f4a7b5daf2b3366 100755 (executable)
@@ -24,6 +24,7 @@ class SAMLLoginView:
         # API reference: https://lazka.github.io/pgi-docs/#WebKit2-4.0
 
         self.success = False
+        self.saml_result = {}
         self.verbose = verbose
 
         self.ctx = WebKit2.WebContext.get_default()
@@ -65,10 +66,13 @@ class SAMLLoginView:
                 if (name.startswith('saml-') or name in ('prelogin-cookie', 'portal-userauthcookie')):
                     t.append((name, value))
             h.foreach(listify)
-            self.saml_result = d = dict(l)
-            if d:
-                if self.verbose:
-                    print("Got SAML relevant headers, done: %r" % d, file=stderr)
+            d = dict(l)
+            if d and self.verbose:
+                print("Got SAML result headers: %r" % d, file=stderr)
+            d = self.saml_result
+            d.update(dict(l))
+            if 'saml-username' in d and ('prelogin-cookie' in d or 'portal-userauthcookie' in d):
+                print("Got all required SAML headers, done.", file=stderr)
                 self.success = True
                 Gtk.main_quit()
 

Community Data Science Collective || Want to submit a patch?