Skip to content

Restructure IP Login Implementation

Date: 2025-02-06

Status: rejected - IP login will be shut off by the end of the year, no more work should flow into this

Context

The current IP login implementation involves a lot of checks in both the configfrontend monolith and the remix-sso library used by the Statista 4.0 apps. This setup requires two implementations of the same logic, one in PHP and one in the remix-sso library, which have to be kept in sync. The existing mechanism is documented in docs/references/auth-methods/iplogin.md.

Additionally, the current implementation has led to unresolved issues such as unwanted IP login attempts and IP mismatch problems. As a workaround for the missing client-side check for cookie support, we implemented the so-called "Fernando solution" which relies on additional redirects between the monolith and the remix-sso app with an additional cookie. Details are documented in docs/explanations/fernando_solution.md.

This ADR proposes to restructure the IP login mechanism to come up with a unified solution for both the monolith and the Statista 4.0 apps, which also addresses the known issues.

Decision

Restructure IP Login

In order to unify the IP login logic for both the monolith and Statista 4.0 apps and mitigate existing problems, we want to restructure the IP login implementation by making the following changes:

  • Move the IP CIDR check from behind Auth0 (using platform-sso-services) to the remix-sso app.
    • This also requires moving the Redis cache and its population function (ip-login-synchronizer-service) to the remix-sso deployment unit.
    • The IP login method is removed from Auth0, including the platform-sso-services and the ip-login-synchronizer-service.
    • The remix-sso app will directly query the IP Redis to check if the IP is allowed to login.
    • The implementation of /sso/iplogin is changed to query the IP Redis and perform an ID login if the IP is allowed to login.
  • Provide the isIpLoginAllowed information to the client, e.g., by adding a flag to the sso/user endpoint (or create a separate endpoint if that is more appropriate).
  • Deliver a React-independent JavaScript library with SSOContextProvider which can be integrated into the configfrontend (like the current React SSOContextProvider is used in the Statista 4.0 application).
    • This context provider calls the sso/user endpoint and decides if an IP login attempt is made based on the response and further client-side checks integrated into the JavaScript code.
  • Remove the code to trigger IP login (IPLoginListener) from the monolith. The user is set in the PHP session if a valid __sso cookie is present as it is currently already implemented in TokenValidatorListener.
  • Ensure the __sso_iplogin cookie is only checked by the remix-sso app, which maintains the cookie:
    • This will fix IP mismatch problems, as the remix-sso app is the only one that needs to evaluate the IP, i.e., the monolith does not need to check the IP anymore.
  • Perform the cookie support check directly in the JavaScript frontend code, allowing the removal of the Fernando solution.
    • This will reduce the number of redirects between the monolith and the remix-sso app and make the __sso_cookie_checker cookie obsolete.

Consequences

Positive Consequences

  • The restructuring will unify the IP login logic and reduce dependency on different headers and cookies.
  • The monolith will no longer handle IP login checks itself, reducing its complexity and maintenance overhead.

Negative Consequences

  • The IP login attempt will cause a flickering effect in the frontend as the IP login is attempted after the initial page load.
  • The remix-sso app will need direct access to the users' database, which requires an additional migration path in the future. Having the IP login behind Auth0 would have allowed migrating the IP login data together with the user data.
  • As we remove IP login as a separate login connection from Auth0, the IP login string in the login ID cannot be used as a workaround for double login. A different solution will be needed.
  • IP login cannot be supported for applications directly interacting with Auth0. This decision will deprecate the IP login as a supported login method in the future.