Page MenuHomePhabricator

Preserve mobile domain when using the shared login domain
Closed, ResolvedPublic

Description

The shared login domain proposed in T363695: Create a Wikimedia login domain that can be served by any wiki does not have a mobile variant, and the domain in the URL path doesn't use it either (so e.g. a user starting login at https://en.m.wikipedia.org/ will be redirected to https://sso.wikimedia.org/en.wikipedia.org/...) but we do need to preserve the fact that the user arrived from a mobile domain, so we can send the user back there after authentication, and so we can point the various links (terms of use etc.) there. We hope to avoid having separate mobile and desktop versions of the login page itself, but eventually needing that isn't completely out of the question either. And we probably need to have some concept of "mobile site" and "desktop site" for analytics, even if its actually the same site, because it is commonly used in our metrics as a proxy for the user using a mobile device.

There are a couple ways to do this:

  • Do set up a separate mobile domain (sso.m.wikimedia.org vs. sso.wikimedia.org). This is straightforward but has lots of negative consequences (splits mobile and desktop login state, splits password manager entries, makes it hard to use WebAuthn etc) so if possible we should avoid it. (login.wikimedia.org also does not have a mobile variant, to avoid splitting the login state.)
  • Use the mobile domain in the URL when indicating where the user came from (ie. https://sso.wikimedia.org/en.m.wikipedia.org/... instead of https://sso.wikimedia.org/en.wikipedia.org/...). That we don't do this already is somewhat of an accident of how mobile domain handling works (the path is generated from $wgServer which does not reflect whether we are on the mobile domain). But the implementation would probably be quite messy:
    • The URL is set up in operations/mediawiki-config, so too early to directly use things like MobileContext, and we'd have to duplicate the relevant logic.
    • MobileContext::usingMobileDomain() is based on a header set in Varnish; we'd either have to fake that, or add some kind of hook mechanism.
    • Even on normal domains, MobileFrontend is not very reliable or predictable at mobilifying URLs.
  • Create a custom mechanism where e.g. login redirects coming from mobile domains include frommobile=1 and that gets passed around and acted upon. This is what Special:CentralLogin/CentralAutoLogin do today, but not great for maintainability.
  • Integrate the concept of domain variants better with MediaWiki core (T195494: Handle mobile domains in core). This would be challenging in terms of change management.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1069675 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/CentralAuth@master] SUL3: Use mobile domain in return URL

https://gerrit.wikimedia.org/r/1069675

Change #1069676 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/CentralAuth@master] SUL3: Allow a callback for CentralAuthSsoUrlPrefix

https://gerrit.wikimedia.org/r/1069676

Change #1069678 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[operations/mediawiki-config@master] SUL3: Use mobile domain in SSO URLs

https://gerrit.wikimedia.org/r/1069678

Change #1069675 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] SUL3: Use mobile domain in return URL

https://gerrit.wikimedia.org/r/1069675

Change #1071269 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/CentralAuth@master] Display mobile view on SSO domain if we arrive from mobile domain

https://gerrit.wikimedia.org/r/1071269

Change #1071269 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Display mobile view on SSO domain if we arrive from mobile view

https://gerrit.wikimedia.org/r/1071269

Change #1072627 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/CentralAuth@master] Rewrite URLs to mobile when using mobile view on shared login domain

https://gerrit.wikimedia.org/r/1072627

Change #1072627 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Rewrite URLs to mobile when using mobile view on shared login domain

https://gerrit.wikimedia.org/r/1072627

I think this is done now, and the remaining open patches are no longer needed, but we should talk this through to make sure I didn't miss anything.

Change #1069676 abandoned by Gergő Tisza:

[mediawiki/extensions/CentralAuth@master] SUL3: Allow a callback for CentralAuthSsoUrlPrefix

Reason:

superseded by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/1072627

https://gerrit.wikimedia.org/r/1069676

Change #1069678 abandoned by Gergő Tisza:

[operations/mediawiki-config@master] SUL3: Use mobile domain in SSO URLs

Reason:

superseded by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/1072627

https://gerrit.wikimedia.org/r/1069678

Agreed this is done, and in a better way than the initial idea. Thanks!

Create a custom mechanism where e.g. login redirects coming from mobile domains include frommobile=1 and that gets passed around and acted upon.

(For the record, we ended up doing something like this but with the non-custom query flag useformat=mobile instead, which is already handled by MobileFrontend so it integrates nicely.)

Tgr reassigned this task from Tgr to matmarex.