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

Fixed tooltip of check results and API

parent 8b161206
Branches
Tags
No related merge requests found
...@@ -31,7 +31,7 @@ def getIDPfqdn(samlrequest_url): ...@@ -31,7 +31,7 @@ def getIDPfqdn(samlrequest_url):
# This function checks if an IdP recognized the SP by presenting its Login page with "username" and "password" fields. # This function checks if an IdP recognized the SP by presenting its Login page with "username" and "password" fields.
# It is possible to disable the check on eccs2properties with the *denylist or by "robots.txt" file into the SAMLRequest endpoint root web dir. # It is possible to disable the check on eccs2properties with the *denylist or by "robots.txt" file into the SAMLRequest endpoint root web dir.
# If the IdP Login page contains "username" and "password" fields, than the test is passed. # If the IdP Login page contains "username" and "password" fields the test is passed.
def checkIdP(sp,idp,test): def checkIdP(sp,idp,test):
# Disable SSL requests warning messages # Disable SSL requests warning messages
...@@ -121,7 +121,7 @@ def checkIdP(sp,idp,test): ...@@ -121,7 +121,7 @@ def checkIdP(sp,idp,test):
if (robots == ""): if (robots == ""):
robots = requests.get("http://%s/robots.txt" % fqdn_idp, headers=headers, verify=True, timeout=ECCS2REQUESTSTIMEOUT) robots = requests.get("http://%s/robots.txt" % fqdn_idp, headers=headers, verify=True, timeout=ECCS2REQUESTSTIMEOUT)
# Catch only SSL Exception. Don't block the ECCS check if other exceptions occurred # Catch SSL Exceptions and block the ECCS check
except (requests.exceptions.SSLError) as e: except (requests.exceptions.SSLError) as e:
check_time = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S') + 'Z' check_time = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S') + 'Z'
...@@ -133,7 +133,7 @@ def checkIdP(sp,idp,test): ...@@ -133,7 +133,7 @@ def checkIdP(sp,idp,test):
return (idp['entityID'],wayfless_url,check_time,"(failed)","SSL-Error") return (idp['entityID'],wayfless_url,check_time,"(failed)","SSL-Error")
# Pass every other exceptions on /robots.txt file. I consider only SSLError. # Pass every other exceptions on /robots.txt file. Consider only SSL Exceptions.
except Exception as e: except Exception as e:
#print("IdP '%s' HAD HAD A REQUEST ERROR: %s" % (fqdn_idp,e.__str__())) #print("IdP '%s' HAD HAD A REQUEST ERROR: %s" % (fqdn_idp,e.__str__()))
robots = "" robots = ""
...@@ -169,33 +169,33 @@ def checkIdP(sp,idp,test): ...@@ -169,33 +169,33 @@ def checkIdP(sp,idp,test):
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
print ("http-code: (failed) - ConnectionError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: (failed) - ConnectionError for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print("!!! REQUESTS STATUS CODE CONNECTION ERROR EXCEPTION !!!") #print("!!! REQUESTS HTTP CODE CONNECTION ERROR EXCEPTION !!!")
#print (e.__str__()) #print (e.__str__())
http_code = "(failed)" http_code = "(failed)"
except requests.exceptions.Timeout as e: except requests.exceptions.Timeout as e:
print ("http-code: 111 - TimeoutError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: (failed) - TimeoutError for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print("!!! REQUESTS STATUS CODE TIMEOUT EXCEPTION !!!") #print("!!! REQUESTS HTTP CODE TIMEOUT EXCEPTION !!!")
#print (e.__str__()) #print (e.__str__())
http_code = "111" http_code = "(failed)"
except requests.exceptions.TooManyRedirects as e: except requests.exceptions.TooManyRedirects as e:
print ("http-code: 222 - TooManyRedirectsError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: (failed) - TooManyRedirectsError for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print("!!! REQUESTS TOO MANY REDIRECTS EXCEPTION !!!") #print("!!! REQUESTS HTTP CODE TOO MANY REDIRECTS EXCEPTION !!!")
#print (e.__str__()) #print (e.__str__())
http_code = "222" http_code = "(failed)"
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
print ("http-code: 333 - RequestException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: (failed) - RequestException for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print ("!!! REQUESTS EXCEPTION !!!") #print ("!!! REQUESTS EXCEPTION !!!")
print (e.__str__()) print (e.__str__())
http_code = "333" http_code = "(failed)"
except Exception as e: except Exception as e:
print ("http-code: 555 - OtherException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: (failed) - OtherException for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print ("!!! EXCEPTION REQUESTS !!!") #print ("!!! EXCEPTION REQUESTS !!!")
print (e.__str__()) print (e.__str__())
http_code = "555" http_code = "(failed)"
if(metadata_not_found): if(metadata_not_found):
return (idp['entityID'],wayfless_url,check_time,http_code,"No-eduGAIN-Metadata") return (idp['entityID'],wayfless_url,check_time,http_code,"No-eduGAIN-Metadata")
...@@ -230,7 +230,7 @@ def storeECCS2result(idp,check_results,idp_status,test): ...@@ -230,7 +230,7 @@ def storeECCS2result(idp,check_results,idp_status,test):
if (test is not True): if (test is not True):
# IdP-DisplayName;IdP-entityID;IdP-RegAuth;IdP-tech-ctc-1,IdP-tech-ctc-2;IdP-supp-ctc-1,IdP-supp-ctc-2;IdP-ECCS-Status;SP-wayfless-url-1;SP-check-time-1;SP-http-code-1;SP-result-1;SP-wayfless-url-2;SP-check-time-2;SP-http-code-2;SP-result-2 # IdP-DisplayName;IdP-entityID;IdP-RegAuth;IdP-tech-ctc-1,IdP-tech-ctc-2;IdP-supp-ctc-1,IdP-supp-ctc-2;IdP-ECCS-Status;SP-wayfless-url-1;SP-check-time-1;SP-http-code-1;SP-result-1;SP-wayfless-url-2;SP-check-time-2;SP-http-code-2;SP-result-2
with open("%s/%s" % (ECCS2OUTPUTDIR,ECCS2RESULTSLOG), 'a') as f: with open("%s/%s" % (ECCS2OUTPUTDIR,ECCS2RESULTSLOG), 'a') as f:
f.write('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"}}\n' % ( f.write('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"}}\n' % (
getDisplayName(idp['displayname']), # IdP-DisplayName getDisplayName(idp['displayname']), # IdP-DisplayName
idp['entityID'], # IdP-entityID idp['entityID'], # IdP-entityID
idp['registrationAuthority'], # IdP-RegAuth idp['registrationAuthority'], # IdP-RegAuth
...@@ -240,14 +240,14 @@ def storeECCS2result(idp,check_results,idp_status,test): ...@@ -240,14 +240,14 @@ def storeECCS2result(idp,check_results,idp_status,test):
check_results[0][1], # SP-wayfless-url-1 check_results[0][1], # SP-wayfless-url-1
check_results[0][2], # SP-check-time-1 check_results[0][2], # SP-check-time-1
check_results[0][3], # SP-http-code-1 check_results[0][3], # SP-http-code-1
check_results[0][4], # SP-result-1 check_results[0][4], # SP-check-result-1
check_results[1][1], # SP-wayfless-url-2 check_results[1][1], # SP-wayfless-url-2
check_results[1][2], # SP-check-time-2 check_results[1][2], # SP-check-time-2
check_results[1][3], # SP-http-code-2 check_results[1][3], # SP-http-code-2
check_results[1][4])) # SP-result-2 check_results[1][4])) # SP-check-result-2
else: else:
print("\nECCS2:") print("\nECCS2:")
print('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","result":"%s"}}\n' % ( print('{"displayName":"%s","entityID":"%s","registrationAuthority":"%s","contacts":{"technical":"%s","support":"%s"},"status":"%s","sp1":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","httpCode":"%s","checkResult":"%s"}}\n' % (
getDisplayName(idp['displayname']), # IdP-DisplayName getDisplayName(idp['displayname']), # IdP-DisplayName
idp['entityID'], # IdP-entityID idp['entityID'], # IdP-entityID
idp['registrationAuthority'], # IdP-RegAuth idp['registrationAuthority'], # IdP-RegAuth
...@@ -257,11 +257,11 @@ def storeECCS2result(idp,check_results,idp_status,test): ...@@ -257,11 +257,11 @@ def storeECCS2result(idp,check_results,idp_status,test):
check_results[0][1], # SP-wayfless-url-1 check_results[0][1], # SP-wayfless-url-1
check_results[0][2], # SP-check-time-1 check_results[0][2], # SP-check-time-1
check_results[0][3], # SP-http-code-1 check_results[0][3], # SP-http-code-1
check_results[0][4], # SP-result-1 check_results[0][4], # SP-check-result-1
check_results[1][1], # SP-wayfless-url-2 check_results[1][1], # SP-wayfless-url-2
check_results[1][2], # SP-check-time-2 check_results[1][2], # SP-check-time-2
check_results[1][3], # SP-http-code-2 check_results[1][3], # SP-http-code-2
check_results[1][4])) # SP-result-2 check_results[1][4])) # SP-check-result-2
# Check an IdP with 2 SPs. # Check an IdP with 2 SPs.
......
...@@ -133,7 +133,6 @@ input[type=checkbox] { ...@@ -133,7 +133,6 @@ input[type=checkbox] {
.tooltip .tooltiptext { .tooltip .tooltiptext {
visibility: hidden; visibility: hidden;
position: absolute; position: absolute;
width: 300px;
background-color: #555; background-color: #555;
color: #fff; color: #fff;
text-align: center; text-align: center;
...@@ -141,7 +140,7 @@ input[type=checkbox] { ...@@ -141,7 +140,7 @@ input[type=checkbox] {
border-radius: 6px; border-radius: 6px;
z-index: 1; z-index: 1;
opacity: 0; opacity: 0;
transition: opacity 0.3s; transition: opacity .6s;
} }
.tooltip:hover .tooltiptext { .tooltip:hover .tooltiptext {
...@@ -149,66 +148,48 @@ input[type=checkbox] { ...@@ -149,66 +148,48 @@ input[type=checkbox] {
opacity: 1; opacity: 1;
} }
.tooltip-right { .tooltip-top {
top: -5px; bottom: 125%;
left: 125%; left: 50%;
} }
.tooltip-right::after { .tooltip-top::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 50%; top: 100%;
right: 100%; left: 50%;
margin-top: -5px; margin-left: -5px;
border-width: 5px; border-width: 5px;
border-style: solid; border-style: solid;
border-color: transparent #555 transparent transparent; border-color: #555 transparent transparent transparent;
} }
.tooltip-bottom { .tooltip-ok {
top: 135%; width: 540px;
left: 50%; margin-left: -270px;
margin-left: -60px;
} }
.tooltip-bottom::after { .tooltip-timeout {
content: ""; width: 380px;
position: absolute; margin-left: -190px;
bottom: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent #555 transparent;
} }
.tooltip-top { .tooltip-invalid-form {
bottom: 125%; width: 260px;
left: 50%; margin-left: -130px;
margin-left: -60px;
} }
.tooltip-top::after { .tooltip-no-edugain-metadata {
content: ""; width: 400px;
position: absolute; margin-left: -200px;
top: 100%;
left: 50%;
margin-left: -5px;
} }
.tooltip-left { .tooltip-ssl-error {
top: auto; width: 280px;
bottom: -15px; margin-left: -140px;
right: 128%;
} }
.tooltip-left::after { .tooltip-disabled {
content: ""; width: 260px;
position: absolute; margin-left: -130px;
top: 50%;
left: 100%;
margin-top: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent transparent #555;
} }
...@@ -49,22 +49,22 @@ function getHostname(url) { ...@@ -49,22 +49,22 @@ function getHostname(url) {
function getCheckResult(checkResult){ function getCheckResult(checkResult){
if (checkResult == "OK"){ if (checkResult == "OK"){
return '<div class="tooltip">OK <span class="tooltiptext tooltip-top">The IdP is consuming correctly the eduGAIN metadata and return a valid login page</span></div>'; return '<div class="tooltip">OK <span class="tooltiptext tooltip-top tooltip-ok">The IdP is consuming correctly the eduGAIN metadata and return a valid login page</span></div>';
} }
else if (checkResult == "Timeout"){ else if (checkResult == "Timeout"){
return '<div class="tooltip">Timeout <span class="tooltiptext tooltip-top">The IdP does not load a valid login page within 60 seconds</span></div>' return '<div class="tooltip">Timeout <span class="tooltiptext tooltip-top tooltip-timeout">The IdP does not load a valid login page within 60 seconds</span></div>'
} }
else if (checkResult == "Invalid-Form"){ else if (checkResult == "Invalid-Form"){
return '<div class="tooltip">Invalid-Form <span class="tooltiptext tooltip-top">The IdP does not load a valid login page</span></div>' return '<div class="tooltip">Invalid-Form <span class="tooltiptext tooltip-top tooltip-invalid-form">The IdP does not load a valid login page</span></div>'
} }
else if (checkResult == "No-eduGAIN-Metadata"){ else if (checkResult == "No-eduGAIN-Metadata"){
return '<div class="tooltip">No-eduGAIN-Metadata <span class="tooltiptext tooltip-top">The IdP is not consuming correctly edugGAIN metadata stream</span></div>' return '<div class="tooltip">No-eduGAIN-Metadata <span class="tooltiptext tooltip-top tooltip-no-edugain-metadata">The IdP is not consuming correctly edugGAIN metadata stream</span></div>'
} }
else if (checkResult == "SSL-Error"){ else if (checkResult == "SSL-Error"){
return '<div class="tooltip">SSL-Error <span class="tooltiptext tooltip-top">The IdP has a problem on its SSL certificate</span></div>' return '<div class="tooltip">SSL-Error <span class="tooltiptext tooltip-top tooltip-ssl-error">The IdP has a problem on its SSL certificate</span></div>'
} }
else if (checkResult == "DISABLED"){ else if (checkResult == "DISABLED"){
return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top">The check has been disabled for the IdP</span></div>' return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top tooltip-disabled">The check has been disabled for the IdP</span></div>'
} }
else{ else{
return checkResult; return checkResult;
...@@ -87,7 +87,7 @@ function format ( d ) { ...@@ -87,7 +87,7 @@ function format ( d ) {
'<td class="strong">Support Contacts:</td>'+ '<td class="strong">Support Contacts:</td>'+
'<td>'+d.contacts.support+'</td>'+ '<td>'+d.contacts.support+'</td>'+
'<td class="strong">Check Time</td>'+ '<td class="strong">Check Time</td>'+
'<td class="strong">Result Check</td>'+ '<td class="strong">Check Result</td>'+
'<td class="strong">HTTP Code</td>'+ '<td class="strong">HTTP Code</td>'+
'<td class="strong">Page Source</td>'+ '<td class="strong">Page Source</td>'+
'<td class="strong">Retry Check</td>'+ '<td class="strong">Retry Check</td>'+
...@@ -96,7 +96,7 @@ function format ( d ) { ...@@ -96,7 +96,7 @@ function format ( d ) {
'<td class="strong">SP1:</td>'+ '<td class="strong">SP1:</td>'+
'<td>https://'+getHostname(d.sp1.wayflessUrl)+'</td>'+ '<td>https://'+getHostname(d.sp1.wayflessUrl)+'</td>'+
'<td>'+d.sp1.checkTime+'</td>'+ '<td>'+d.sp1.checkTime+'</td>'+
'<td>'+getCheckResult(d.sp1.result)+'</td>'+ '<td>'+getCheckResult(d.sp1.checkResult)+'</td>'+
'<td>'+d.sp1.httpCode+'</td>'+ '<td>'+d.sp1.httpCode+'</td>'+
'<td><a href="/eccs2html/'+d.date+'/'+getHostname(d.entityID)+'---'+getHostname(d.sp1.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+ '<td><a href="/eccs2html/'+d.date+'/'+getHostname(d.entityID)+'---'+getHostname(d.sp1.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+
'<td><a href="'+d.sp1.wayflessUrl+'" target="_blank">Click to retry</a></td>'+ '<td><a href="'+d.sp1.wayflessUrl+'" target="_blank">Click to retry</a></td>'+
...@@ -105,7 +105,7 @@ function format ( d ) { ...@@ -105,7 +105,7 @@ function format ( d ) {
'<td class="strong">SP2:</td>'+ '<td class="strong">SP2:</td>'+
'<td>https://'+getHostname(d.sp2.wayflessUrl)+'</td>'+ '<td>https://'+getHostname(d.sp2.wayflessUrl)+'</td>'+
'<td>'+d.sp2.checkTime+'</td>'+ '<td>'+d.sp2.checkTime+'</td>'+
'<td>'+getCheckResult(d.sp2.result)+'</td>'+ '<td>'+getCheckResult(d.sp2.checkResult)+'</td>'+
'<td>'+d.sp2.httpCode+'</td>'+ '<td>'+d.sp2.httpCode+'</td>'+
'<td><a href="/eccs2html/'+d.date+'/'+getHostname(d.entityID)+'---'+getHostname(d.sp2.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+ '<td><a href="/eccs2html/'+d.date+'/'+getHostname(d.entityID)+'---'+getHostname(d.sp2.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+
'<td><a href="'+d.sp2.wayflessUrl+'" target="_blank">Click to retry</a></td>'+ '<td><a href="'+d.sp2.wayflessUrl+'" target="_blank">Click to retry</a></td>'+
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment