From b71fc6c36d0f1b2589e44166a056ac76bc99ccc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= Date: Thu, 2 Jun 2016 19:56:59 +0200 Subject: [PATCH] [#1] Support 'local' authententication (used in sandbox) --- slipsomat.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/slipsomat.py b/slipsomat.py index 9be3bcd..1e61e26 100644 --- a/slipsomat.py +++ b/slipsomat.py @@ -145,19 +145,24 @@ def connect(self): domain = self.config.get('login', 'domain') self.instance = self.config.get('login', 'instance') auth_type = self.config.get('login', 'auth_type') + institution = self.config.get('login', 'institution') username = self.config.get('login', 'username') password = self.config.get('login', 'password') self.driver = self.get_driver() - print('Logging in to {} as {}... '.format(domain, username)) - self.get('/mng/login?auth={}'.format(auth_type)) + print('Opening instance {}:{}'.format(self.instance, institution)) - try: - element = self.driver.find_element_by_id("org") + self.get('/mng/login?institute={}&auth={}'.format(institution, auth_type)) - select = Select(element) - select.select_by_value(domain) - element.submit() + try: + if auth_type == 'SAML': + print('Logging in as {}@{}'.format(username, domain)) + element = self.driver.find_element_by_id("org") + select = Select(element) + select.select_by_value(domain) + element.submit() + else: + print('Logging in as {}'.format(username)) element = self.driver.find_element_by_id('username') element.send_keys(username)