Skip to content
Snippets Groups Projects
Commit 44c0d48c authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Resolved issue #8 - Added HTTP Basic Authn support

parent 7139d7f1
No related branches found
No related tags found
No related merge requests found
...@@ -332,19 +332,38 @@ def check_idp_response_selenium(sp,idp,test): ...@@ -332,19 +332,38 @@ def check_idp_response_selenium(sp,idp,test):
stored = store_page_source(pgsrc,idp,sp,test) stored = store_page_source(pgsrc,idp,sp,test)
if (stored): if (stored):
return (idp['entityID'],wayfless_url,check_time,"No-eduGAIN-Metadata",webdriver_error) return (idp['entityID'],wayfless_url,check_time,"No-eduGAIN-Metadata",webdriver_error)
elif(driver.page_source != "<html><head></head><body></body></html>"): else:
if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source}\nInvalid-Form: No valid login form found in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds" try:
else: pgsrc = f"<h1>Invalid Form: no valid login form found in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds</h1><h2>PAGE SOURCE:</h2><br/>{driver.page_source}" response = requests.get(f"{driver.current_url}", timeout=e_p.ECCS_REQUESTSTIMEOUT)
stored = store_page_source(pgsrc,idp,sp,test)
if (stored): if (response.status_code == 401):
return (idp['entityID'],wayfless_url,check_time,"Invalid-Form",webdriver_error) if (test): pgsrc = f"\n[PAGE_SOURCE]\nHTTP Basic Authentication\n[URL]{driver.current_url} - 401 STATUS CODE FOUND"
else: else: pgsrc = driver.page_source
if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source}\nTimeout: No valid login form loaded in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds." stored = store_page_source(pgsrc,idp,sp,test)
else: pgsrc = f"<h1>Timeout - No valid login form found in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds.</h1><h2>PAGE SOURCE:</h2><br/>{driver.page_source}" if (stored):
stored = store_page_source(pgsrc,idp,sp,test) return (idp['entityID'],wayfless_url,check_time,"OK",webdriver_error)
if (stored):
return (idp['entityID'],wayfless_url,check_time,"Timeout",webdriver_error) if (response.status_code == 403):
if (test): pgsrc = f"\n[PAGE_SOURCE]\nForbidden\n[URL]{driver.current_url} - 403 STATUS CODE FOUND"
else: pgsrc = driver.page_source
stored = store_page_source(pgsrc,idp,sp,test)
if (stored):
return (idp['entityID'],wayfless_url,check_time,"IdP-Error",webdriver_error)
except:
pass # ignore all requests exceptions
if (driver.page_source != "<html><head></head><body></body></html>"):
if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source}\nInvalid-Form: No valid login form found in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds"
else: pgsrc = f"<h1>Invalid Form: no valid login form found in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds</h1><h2>PAGE SOURCE:</h2><br/>{driver.page_source}"
stored = store_page_source(pgsrc,idp,sp,test)
if (stored):
return (idp['entityID'],wayfless_url,check_time,"Invalid-Form",webdriver_error)
else:
if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source}\nTimeout: No valid login form loaded in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds."
else: pgsrc = f"<h1>Timeout - No valid login form found in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds.</h1><h2>PAGE SOURCE:</h2><br/>{driver.page_source}"
stored = store_page_source(pgsrc,idp,sp,test)
if (stored):
return (idp['entityID'],wayfless_url,check_time,"Timeout",webdriver_error)
except e: except e:
if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source}\nTimeout: No valid login form loaded in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds." if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source}\nTimeout: No valid login form loaded in {e_p.ECCS_SELENIUMPAGELOADTIMEOUT} seconds."
else: pgsrc = driver.page_source else: pgsrc = driver.page_source
...@@ -352,7 +371,6 @@ def check_idp_response_selenium(sp,idp,test): ...@@ -352,7 +371,6 @@ def check_idp_response_selenium(sp,idp,test):
if (stored): if (stored):
return (idp['entityID'],wayfless_url,check_time,"Timeout",webdriver_error) return (idp['entityID'],wayfless_url,check_time,"Timeout",webdriver_error)
# <input type="password"> found # <input type="password"> found
# This IF is for those IdPs that Timeout is caused by an image or other that do not prevent the Login process. # This IF is for those IdPs that Timeout is caused by an image or other that do not prevent the Login process.
if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source} - Timeout but OK" if (test): pgsrc = f"\n[PAGE_SOURCE]\n{driver.page_source} - Timeout but OK"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment