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

Added information tooltip of check results

parent dbf92710
No related branches found
No related tags found
No related merge requests found
...@@ -77,7 +77,7 @@ def checkIdP(sp,idp,test): ...@@ -77,7 +77,7 @@ def checkIdP(sp,idp,test):
return (idp['entityID'],wayfless_url,check_time,"NULL","DISABLED") return (idp['entityID'],wayfless_url,check_time,"NULL","DISABLED")
# Open SP, select the IDP from the EDS and press 'Enter' to reach the IdP login page to check # Open SP via wayfless_url and reach the IdP login page to check
try: try:
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'
driver.get(wayfless_url) driver.get(wayfless_url)
...@@ -165,44 +165,44 @@ def checkIdP(sp,idp,test): ...@@ -165,44 +165,44 @@ def checkIdP(sp,idp,test):
try: try:
headers = {'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'} headers = {'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'}
status_code = str(requests.get(samlrequest_url, headers=headers, verify=False, timeout=ECCS2REQUESTSTIMEOUT).status_code) http_code = str(requests.get(samlrequest_url, headers=headers, verify=False, timeout=ECCS2REQUESTSTIMEOUT).status_code)
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e:
print ("status-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 STATUS CODE CONNECTION ERROR EXCEPTION !!!")
#print (e.__str__()) #print (e.__str__())
status_code = "(failed)" http_code = "(failed)"
except requests.exceptions.Timeout as e: except requests.exceptions.Timeout as e:
print ("status-code: 111 - TimeoutError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: 111 - TimeoutError for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print("!!! REQUESTS STATUS CODE TIMEOUT EXCEPTION !!!") #print("!!! REQUESTS STATUS CODE TIMEOUT EXCEPTION !!!")
#print (e.__str__()) #print (e.__str__())
status_code = "111" http_code = "111"
except requests.exceptions.TooManyRedirects as e: except requests.exceptions.TooManyRedirects as e:
print ("status-code: 222 - TooManyRedirectsError for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: 222 - TooManyRedirectsError for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print("!!! REQUESTS TOO MANY REDIRECTS EXCEPTION !!!") #print("!!! REQUESTS TOO MANY REDIRECTS EXCEPTION !!!")
#print (e.__str__()) #print (e.__str__())
status_code = "222" http_code = "222"
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
print ("status-code: 333 - RequestException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: 333 - RequestException for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print ("!!! REQUESTS EXCEPTION !!!") #print ("!!! REQUESTS EXCEPTION !!!")
print (e.__str__()) print (e.__str__())
status_code = "333" http_code = "333"
except Exception as e: except Exception as e:
print ("status-code: 555 - OtherException for IdP '%s' with SP '%s'" % (idp['entityID'],sp)) print ("http-code: 555 - OtherException for IdP '%s' with SP '%s'" % (idp['entityID'],sp))
#print ("!!! EXCEPTION REQUESTS !!!") #print ("!!! EXCEPTION REQUESTS !!!")
print (e.__str__()) print (e.__str__())
status_code = "555" http_code = "555"
if(metadata_not_found): if(metadata_not_found):
return (idp['entityID'],wayfless_url,check_time,status_code,"No-eduGAIN-Metadata") return (idp['entityID'],wayfless_url,check_time,http_code,"No-eduGAIN-Metadata")
elif not username_found or not password_found: elif not username_found or not password_found:
return (idp['entityID'],wayfless_url,check_time,status_code,"Invalid-Form") return (idp['entityID'],wayfless_url,check_time,http_code,"Invalid-Form")
else: else:
return (idp['entityID'],wayfless_url,check_time,status_code,"OK") return (idp['entityID'],wayfless_url,check_time,http_code,"OK")
# Extract IdP DisplayName by fixing input string # Extract IdP DisplayName by fixing input string
...@@ -228,9 +228,9 @@ def storeECCS2result(idp,check_results,idp_status,test): ...@@ -228,9 +228,9 @@ def storeECCS2result(idp,check_results,idp_status,test):
str_support_contacts = ','.join(list_support_contacts) str_support_contacts = ','.join(list_support_contacts)
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-status-code-1;SP-result-1;SP-wayfless-url-2;SP-check-time-2;SP-status-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","statusCode":"%s","status":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","statusCode":"%s","status":"%s"}}\n' % ( 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' % (
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
...@@ -239,15 +239,15 @@ def storeECCS2result(idp,check_results,idp_status,test): ...@@ -239,15 +239,15 @@ def storeECCS2result(idp,check_results,idp_status,test):
idp_status, # IdP-ECCS-Status idp_status, # IdP-ECCS-Status
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-status-code-1 check_results[0][3], # SP-http-code-1
check_results[0][4], # SP-result-1 check_results[0][4], # SP-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-status-code-2 check_results[1][3], # SP-http-code-2
check_results[1][4])) # SP-result-2 check_results[1][4])) # SP-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","statusCode":"%s","status":"%s"},"sp2":{"wayflessUrl":"%s","checkTime":"%s","statusCode":"%s","status":"%s"}}\n' % ( 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' % (
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
...@@ -256,11 +256,11 @@ def storeECCS2result(idp,check_results,idp_status,test): ...@@ -256,11 +256,11 @@ def storeECCS2result(idp,check_results,idp_status,test):
idp_status, # IdP-ECCS-Status idp_status, # IdP-ECCS-Status
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-status-code-1 check_results[0][3], # SP-http-code-1
check_results[0][4], # SP-result-1 check_results[0][4], # SP-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-status-code-2 check_results[1][3], # SP-http-code-2
check_results[1][4])) # SP-result-2 check_results[1][4])) # SP-result-2
......
...@@ -122,3 +122,93 @@ input[type=checkbox] { ...@@ -122,3 +122,93 @@ input[type=checkbox] {
bottom: 1px; bottom: 1px;
} }
} }
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted #ccc;
color: #004360;
}
.tooltip .tooltiptext {
visibility: hidden;
position: absolute;
width: 300px;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
z-index: 1;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
.tooltip-right {
top: -5px;
left: 125%;
}
.tooltip-right::after {
content: "";
position: absolute;
top: 50%;
right: 100%;
margin-top: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent #555 transparent transparent;
}
.tooltip-bottom {
top: 135%;
left: 50%;
margin-left: -60px;
}
.tooltip-bottom::after {
content: "";
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent #555 transparent;
}
.tooltip-top {
bottom: 125%;
left: 50%;
margin-left: -60px;
}
.tooltip-top::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
}
.tooltip-left {
top: auto;
bottom: -15px;
right: 128%;
}
.tooltip-left::after {
content: "";
position: absolute;
top: 50%;
left: 100%;
margin-top: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent transparent #555;
}
...@@ -47,6 +47,30 @@ function getHostname(url) { ...@@ -47,6 +47,30 @@ function getHostname(url) {
} }
} }
function getCheckResult(checkResult){
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>';
}
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>'
}
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>'
}
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>'
}
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>'
}
else if (checkResult == "DISABLED"){
return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top">The check has been disabled for the IdP</span></div>'
}
else{
return checkResult;
}
}
/* Formatting function for row details - modify as you need */ /* Formatting function for row details - modify as you need */
function format ( d ) { function format ( d ) {
// `d` is the original data object for the row // `d` is the original data object for the row
...@@ -64,7 +88,7 @@ function format ( d ) { ...@@ -64,7 +88,7 @@ function format ( d ) {
'<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">Result Check</td>'+
'<td class="strong">Status 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>'+
'</tr>'+ '</tr>'+
...@@ -72,8 +96,8 @@ function format ( d ) { ...@@ -72,8 +96,8 @@ 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>'+d.sp1.status+'</td>'+ '<td>'+getCheckResult(d.sp1.result)+'</td>'+
'<td>'+d.sp1.statusCode+'</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>'+
'</tr>'+ '</tr>'+
...@@ -81,8 +105,8 @@ function format ( d ) { ...@@ -81,8 +105,8 @@ 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>'+d.sp2.status+'</td>'+ '<td>'+getCheckResult(d.sp2.result)+'</td>'+
'<td>'+d.sp2.statusCode+'</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>'+
'</tr>'+ '</tr>'+
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment