T363695: Create a Wikimedia login domain that can be served by any wiki proposes a shared domain that can be served by any wiki, and is restricted to authentication workflows (login, signup, credentials change). The restriction means that we want most links (e.g. terms of use, links in customized i18n messages) to not use the shared domain but send back the user to the normal domain of the wiki where they started authentication. But links that are part of the authentication flow (e.g. switching from login to signup) should not be changed. We need to figure out the way to do that.
This has a strong overlap with figuring out which links should open in the same window in display=popup mode (T362706: Permit displaying the login / signup page in a popup or iframe) which was eventually handled via a HTML post-processing step in SkinAuthenticationPopup::openLinksInNewWindow(). Probably we could use a shared mechanism for both (and for indicating which links are in-flow vs. out-of-flow for authentication).