Skip to content

Shared authentication mechanism across pyobs web projects (robotic-backend, archive, ...) #748

Description

@thusser

Problem

Each pyobs web service currently rolls its own auth, uncoordinated:

  • pyobs-archive (pyobs_archive/authentication/backends.py) already delegates to an external OAuth2 provider ("odin"): OAuth2Backend does a password-grant token exchange against settings.OAUTH_CLIENT['TOKEN_URL'], and BearerAuthentication validates bearer tokens against a PROFILE_URL. Successful auth mints/updates a local Django User + Profile (storing the odin access/refresh token).
  • pyobs-robotic-backend (settings.py DEFAULT_AUTHENTICATION_CLASSES) uses plain DRF TokenAuthentication + SessionAuthentication against its own local Django user database — no connection to odin or to archive's users at all.

No shared identity: a user (or a service) authenticated against one pyobs web project has no way to be recognized by another. This will only get worse as more web services join the ecosystem.

Question

What should replace this? Some options to weigh:

  1. Standardize on the existing odin OAuth2 provider — reuse archive's pattern (OAuth2Backend/BearerAuthentication) in robotic-backend and future services, so there's one identity provider instead of N local user tables. Lowest-effort given odin already exists and is already proven in archive.
  2. A dedicated new OAuth/OIDC provider for the pyobs ecosystem — more standard (OIDC discovery, refresh tokens, scopes) but is new infrastructure to stand up and operate.
  3. Something else — shared JWT-signing secret/service tokens for service-to-service calls (e.g. Mastermind -> robotic-backend), separate from end-user SSO? These may be two different problems (user login SSO vs. inter-service auth) that shouldn't necessarily share one mechanism.

Scope questions to resolve before implementing

  • Is this about user-facing SSO (one login across archive/robotic-backend/future dashboards), service-to-service auth (e.g. pyobs-core modules calling robotic-backend's API), or both?
  • Does odin (referenced in archive's code, no design doc found for it) still exist/is still the org's intended identity provider, or was it specific to a past deployment?
  • Where should a shared auth client library live — a new pyobs-auth package, or duplicated per-service (current state, what we're trying to get away from)?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions