Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Connectivity Check
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Connectivity Check
Commits
ce7e223c
Commit
ce7e223c
authored
3 years ago
by
Marco Malavolti
Browse files
Options
Downloads
Patches
Plain Diff
Improved Selenium check
parent
cb5eeb66
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
eccs2properties.py
+1
-1
1 addition, 1 deletion
eccs2properties.py
utils.py
+22
-3
22 additions, 3 deletions
utils.py
with
23 additions
and
4 deletions
eccs2properties.py
+
1
−
1
View file @
ce7e223c
...
@@ -48,7 +48,7 @@ ECCS2SPS = [
...
@@ -48,7 +48,7 @@ ECCS2SPS = [
ROBOTS_USER_AGENT
=
"
ECCS/2.0 (+https://technical-test.edugain.org/eccs2)
"
ROBOTS_USER_AGENT
=
"
ECCS/2.0 (+https://technical-test.edugain.org/eccs2)
"
# PATTERNS
# PATTERNS
METADATAPATTERN
=
"
Unable.to.locate(\sissuer.in|).metadata(\sfor|)|no.metadata.found|profile.is.not.configured.for.relying.party|Cannot.locate.entity|fail.to.load.unknown.provider|does.not.recognise.the.service|unable.to.load.provider|Nous.n
'
avons.pas.pu.(charg|charger).le.fournisseur.de service|Metadata.not.found|application.you.have.accessed.is.not.registered.for.use.with.this.service|Message.did.not.meet.security.requirements|Unsupported.Request|Not.Authorized|METADATANOTFOUND|Unknown.login.requester|is.unspecified.or.unsupported|Unknown.service.provider|Richiesta.non.supportata|Metadati.non.trovati|untrusted.provider|Unregistered.Service
"
METADATAPATTERN
=
"
Unable.to.locate(\sissuer.in|).metadata(\sfor|)|no.metadata.found|profile.is.not.configured.for.relying.party|Cannot.locate.entity|fail.to.load.unknown.provider|does.not.recognise.the.service|unable.to.load.provider|Nous.n
'
avons.pas.pu.(charg|charger).le.fournisseur.de service|Metadata.not.found|application.you.have.accessed.is.not.registered.for.use.with.this.service|Message.did.not.meet.security.requirements|Unsupported.Request|Not.Authorized|METADATANOTFOUND|Unknown.login.requester|is.unspecified.or.unsupported|Unknown.service.provider|Richiesta.non.supportata|Metadati.non.trovati|untrusted.provider|Unregistered.Service
|Unsupported.request|UNHANDLEDEXCEPTION|Metadata.*.expired|Could.not.find.any.*.metadata.*.for
"
USERNAMEPATTERN
=
'
<input[\s]+[^>]*((type=\s*[
\'
"
](text|email)[
\'
"
]|user)|(name=\s*[
\'
"
](name)[
\'
"
]))[^>]*>
'
USERNAMEPATTERN
=
'
<input[\s]+[^>]*((type=\s*[
\'
"
](text|email)[
\'
"
]|user)|(name=\s*[
\'
"
](name)[
\'
"
]))[^>]*>
'
PASSWORDPATTERN
=
'
<input[\s]+[^>]*(type=\s*[
\'
"
]password[
\'
"
]|password)[^>]*>
'
PASSWORDPATTERN
=
'
<input[\s]+[^>]*(type=\s*[
\'
"
]password[
\'
"
]|password)[^>]*>
'
REFUSEDPATTERN
=
'
(^http)(.*\.png$)|(.*\.css$)|(.*\.js$)|(.*\.gif$)|(.*\.svg$)|(.*\.jpg$)
'
REFUSEDPATTERN
=
'
(^http)(.*\.png$)|(.*\.css$)|(.*\.js$)|(.*\.gif$)|(.*\.svg$)|(.*\.jpg$)
'
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
22
−
3
View file @
ce7e223c
...
@@ -160,7 +160,7 @@ def get_driver_selenium(idp=None,sp=None,debugSelenium=False):
...
@@ -160,7 +160,7 @@ def get_driver_selenium(idp=None,sp=None,debugSelenium=False):
# Configure Web-driver
# Configure Web-driver
# https://peter.sh/experiments/chromium-command-line-switches/
# https://peter.sh/experiments/chromium-command-line-switches/
chrome_options
=
Options
()
chrome_options
=
Options
()
chrome_options
.
page_load_strategy
=
'
eager
'
chrome_options
.
page_load_strategy
=
'
normal
'
chrome_options
.
add_argument
(
'
--start-in-incognito
'
)
chrome_options
.
add_argument
(
'
--start-in-incognito
'
)
chrome_options
.
add_argument
(
'
--headless
'
)
chrome_options
.
add_argument
(
'
--headless
'
)
...
@@ -287,8 +287,17 @@ def check_idp_response_selenium(sp,idp,test):
...
@@ -287,8 +287,17 @@ def check_idp_response_selenium(sp,idp,test):
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
)
metadata_not_found
=
re
.
search
(
e2p
.
METADATAPATTERN
,
driver
.
page_source
,
re
.
I
)
if
(
metadata_not_found
):
if
(
test
):
pgsrc
=
f
"
\n
[PAGE_SOURCE]
\n
{
page_source
}
\n
[WAYFLESS URL]
{
wayfless_url
}
- METADATA NOT FOUND
"
else
:
pgsrc
=
driver
.
page_source
stored
=
store_page_source
(
pgsrc
,
idp
,
sp
,
test
)
if
(
stored
):
return
(
idp
[
'
entityID
'
],
wayfless_url
,
check_time
,
http_code
,
"
No-eduGAIN-Metadata
"
,
webdriver_error
)
# If meet <iframe> load it
# If meet <iframe> load it
if
(
"
<iframe
"
in
driver
.
page_source
):
if
(
'
<iframe
'
in
driver
.
page_source
):
seq
=
driver
.
find_elements_by_tag_name
(
'
iframe
'
)
seq
=
driver
.
find_elements_by_tag_name
(
'
iframe
'
)
#switching between the iframes based on index
#switching between the iframes based on index
...
@@ -326,18 +335,28 @@ def check_idp_response_selenium(sp,idp,test):
...
@@ -326,18 +335,28 @@ def check_idp_response_selenium(sp,idp,test):
metadata_not_found
=
re
.
search
(
e2p
.
METADATAPATTERN
,
page_source
,
re
.
I
)
metadata_not_found
=
re
.
search
(
e2p
.
METADATAPATTERN
,
page_source
,
re
.
I
)
# This IF is for those IdP that doesn't consuming the eduGAIN metadata and reaching Timeout
if
(
metadata_not_found
):
if
(
metadata_not_found
):
if
(
test
):
pgsrc
=
f
"
\n
[PAGE_SOURCE]
\n
{
page_source
}
\n
[WAYFLESS URL]
{
wayfless_url
}
- METADATA NOT FOUND
"
if
(
test
):
pgsrc
=
f
"
\n
[PAGE_SOURCE]
\n
{
page_source
}
\n
[WAYFLESS URL]
{
wayfless_url
}
- METADATA NOT FOUND
"
else
:
pgsrc
=
page_source
else
:
pgsrc
=
page_source
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
,
http_code
,
"
No-eduGAIN-Metadata
"
,
webdriver_error
)
return
(
idp
[
'
entityID
'
],
wayfless_url
,
check_time
,
http_code
,
"
No-eduGAIN-Metadata
"
,
webdriver_error
)
# This IF is for those IdP that reaching out Timeout without any contents on their source page
elif
(
page_source
==
"
<html><head></head><body></body></html>
"
):
elif
(
page_source
==
"
<html><head></head><body></body></html>
"
):
if
(
test
):
pgsrc
=
f
"
\n
Timeout: No valid login form loaded in
{
e2p
.
ECCS2SELENIUMPAGELOADTIMEOUT
}
seconds
"
if
(
test
):
pgsrc
=
f
"
\n
Timeout: No valid login form loaded in
{
e2p
.
ECCS2SELENIUMPAGELOADTIMEOUT
}
seconds
"
else
:
pgsrc
=
page_source
else
:
pgsrc
=
page_source
stored
=
store_page_source
(
pgsrc
,
idp
,
sp
,
test
)
stored
=
store_page_source
(
f
"
<h1>Timeout - No valid login form loaded into
{
e2p
.
ECCS2SELENIUMPAGELOADTIMEOUT
}
seconds.
"
,
idp
,
sp
,
test
)
if
(
stored
):
if
(
stored
):
return
(
idp
[
'
entityID
'
],
wayfless_url
,
check_time
,
"
(failed)
"
,
"
Timeout
"
,
webdriver_error
)
return
(
idp
[
'
entityID
'
],
wayfless_url
,
check_time
,
"
(failed)
"
,
"
Timeout
"
,
webdriver_error
)
# This IF is for those IdPs that Timeout is caused by an image or other that do now prevent the Login process.
elif
(
EC
.
presence_of_element_located
((
By
.
XPATH
,
'
//input[@type=
"
password
"
]
'
))):
if
(
test
):
pgsrc
=
f
"
\n
[WAYFLESS URL]
{
wayfless_url
}
- Timeout but OK
"
else
:
pgsrc
=
page_source
stored
=
store_page_source
(
pgsrc
,
idp
,
sp
,
test
)
if
(
stored
):
return
(
idp
[
'
entityID
'
],
wayfless_url
,
check_time
,
http_code
,
"
OK
"
,
webdriver_error
)
# Final else is for all the other cases
else
:
else
:
if
(
test
):
pgsrc
=
f
"
\n
Invalid-Form: No valid login form found in
{
e2p
.
ECCS2SELENIUMPAGELOADTIMEOUT
}
seconds
"
if
(
test
):
pgsrc
=
f
"
\n
Invalid-Form: No valid login form found in
{
e2p
.
ECCS2SELENIUMPAGELOADTIMEOUT
}
seconds
"
else
:
pgsrc
=
page_source
else
:
pgsrc
=
page_source
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment