Skip to content

Keycloak: one login and one token issuer for all Pyronear services #23

Open
0 of 7 issues completed
Open

Description

@fe51

Context & Objective

Authentication is handled separately in each service: the API has its own users and signs its own tokens, the platform and the annotator have their own login, and cameras use one-year tokens. Keycloak (OAuth2 / OIDC) would let us handle users, roles, password reset, MFA and SSO in one place, remove home-made security code, and answer what users and tenders ask for (it is common in professional and industrial information systems). Contributors are already working on it.

Objective: Keycloak becomes the single token issuer. The API, the platform, the annotator and the cameras only verify tokens.

What is done currently

What has to be done

One epic. Users (T4-26) and cameras (T1-27) are two phases, carried by the Period of each sub-issue. Sub-issues in each repo, in this order:

  1. Dev environment (feat: add service keycloak pyro-envdev#45, #50): local Keycloak with a realm for tests, to build and test everything else.
  2. Users (feat: Keycloak: Delegate user authentication to Keycloak (keep camera auth unchanged) pyro-api#698): the API verifies Keycloak tokens for users; users move to Keycloak; camera tokens stay as they are.
  3. Platform (feat: replace auth with keycloak new-pyro-platform#295): OIDC login in the front; token expiry handled (As a user, when my token expire, i want to be notified new-pyro-platform#11).
  4. Annotator (Discussion: Keycloak for pyro-annotator authentication pyro-annotator#412): decide the user login option; import through a Keycloak service account.
  5. Production-ready Keycloak configuration (Keycloak configuration ready for production pi-manager-template#115): a config of Keycloak that can be deployed in production (database, backups, TLS, realm, upgrades).
  6. Cameras (feat: Keycloak: Move camera authentication to Keycloak pyro-api#699, plus a companion issue Authenticate cameras with Keycloak (client credentials) pyro-engine#453; pyroclient lives in pyro-api/client and is part of feat: Keycloak: Move camera authentication to Keycloak pyro-api#699): client credentials per camera, replaced progressively on the fleet.
  7. Rights built on top: roles by organisation, sites and livestream rights (a separate epic on sites, organisations and rights, to come).

Open questions

  • Who operates the production Keycloak (database, upgrades, backups, TLS), and where does it run?
  • Rollout for cameras: devices are updated progressively, so the API accepts both issuers for a while. How long?
  • Intermittent 4G: what token lifetime, and how does a station behave when a refresh fails?
  • Order with the Theodo hackathon (end of November): does the annotator need Keycloak before it?
  • Existing accounts: one-shot migration script, and how users are told.

Done when

  • Users of the platform, the API and the annotator log in through Keycloak
  • The API no longer issues tokens and no longer stores users
  • Cameras authenticate through Keycloak and tokens refresh without blocking local detection
  • A production-ready Keycloak configuration exists in pi-manager-template, documented and backed up
  • Linked sub-issues are closed in each repo

Theme Services · Priority P1 (high) · Period T4-26, T1-27

Metadata

Metadata

Assignees

Labels

P1Indispensable avant l'été prochainT1-27Période janv. à mars 2027T4-26Période oct. à déc. 2026devopsThématique DevOpsepicGrand projet de la roadmap

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions