fractal-analytics-platform / fractal-server

Fractal backend
https://fractal-analytics-platform.github.io/fractal-server/
BSD 3-Clause "New" or "Revised" License
11 stars 3 forks source link

Test OAuth2 integration within CI #1652

Closed tcompa closed 3 months ago

tcompa commented 3 months ago

Right now we are only testing some unit behaviors of the OAuth configuration, but we don't have the actual authentication procedure tested automatically.

We should explore automated testing, in view of when this authentication procedure will be used more.

There are multiple options:

  1. Existing playgrounds (e.g. https://www.oauth.com/playground, https://docs.wiremock.io/oauth2-mock/)
  2. A mock server from within pytest (does it exist?)
  3. A fake FastAPI app that simply sends some expected responses to a set of given API calls.
  4. An actual server from within a container (e.g. https://github.com/navikt/mock-oauth2-server)
  5. ...
tcompa commented 3 months ago

The solution used by @ychiucco in #1665 is to use https://dexidp.io containers. Quoting from the docs

Dex is an identity service that uses OpenID Connect to drive authentication for other apps. Dex acts as a portal to other identity providers through “connectors.” This lets Dex defer authentication to LDAP servers, SAML providers, or established identity providers like GitHub, Google, and Active Directory.

Apart from our testing use case, it's good to be aware of this mainstream tool - in case we'll get back to discussions about authentication in different environments.