fix: yield to the user on federated login pages instead of thrashing#12
Open
enieuwy wants to merge 1 commit into
Open
fix: yield to the user on federated login pages instead of thrashing#12enieuwy wants to merge 1 commit into
enieuwy wants to merge 1 commit into
Conversation
During the manual-login wait, _complete_login_from_current_page re-clicks the SSO/OpenAthens entries every 3s unless _is_human_login_page() returns True. That detector only recognized Chinese-academia hosts (.edu.cn etc.), so on login.openathens.net it kept returning False -> the loop navigated the page on a 3s cycle and the user could never enter their institution/credentials. Recognize federated-access hubs (OpenAthens, SeamlessAccess) and common IdP providers (Azure AD, Okta, Auth0, Duo, Ping) as human-login pages, and add international academic host suffixes (.edu.au, .ac.uk, .ac.nz, .edu.sg, ...). The automation never fills credentials, so treating any real login/IdP page as 'wait' is safe; publisher pages are unaffected and still get the SSO-entry click. Adds a unit test covering OpenAthens/SeamlessAccess/Azure/Duo/AU+UK IdPs as human-login and publisher pages as not.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
During the visible-browser manual-login wait,
_complete_login_from_current_pagere-clicks the SSO/OpenAthens entry controls every ~3s unless_is_human_login_page()returns True. That detector only recognized Chinese-academia hosts (.edu.cn,.ac.cn, ...), so onlogin.openathens.net(and other non-CN IdPs) it returned False and the loop kept navigating the page on a 3s cycle. The user could never type their institution/credentials — the page visibly flickered between 'Forgotten your password?' and 'Sign in with your institution'.This makes interactive institutional login impossible for OpenAthens / AAF (Australia) / UK / etc. users.
Fix
Recognize real login/IdP pages so the loop yields:
openathens.net,seamlessaccess.org.microsoftonline.com), Okta, Auth0, Duo, Ping..edu.au,.ac.uk,.ac.nz,.edu.sg,.ac.jp,.ac.za,.ac.in,.edu.in,.ac.kr,.edu.my.The automation never fills credentials, so treating any real login/IdP page as 'wait' is safe; publisher pages are unaffected and still get the SSO-entry click.
Verified live
With this fix,
instsci publisher-batchagainst a Wiley DOI completed a real University of New England OpenAthens login in the visible browser and captured the verified PDF (Done: 1/1 verified PDFs). Before the fix the same flow was unusable (page thrashing).Tests
tests/test_human_login_page.py: OpenAthens / SeamlessAccess / Azure AD / Duo / AU + UK university IdPs are treated as human-login; publisher article pages are not.Based on
main.