Skip to content

feat(plugins): add credentials of backends #794

Closed

Description

@uniqueg

Problem

FOCA's typed backend lists name the credentials of each backend (ServiceEntry.auth: client_credentials, basic or none; RegistryEntry.auth; Backend.auth; OutboundRequest.auth), but FOCA doesn't resolve them. Every gateway implements this itself: proTES has an OAuth 2.0 client credentials client with a thread-safe token cache, per-backend audiences, OIDC discovery of the token endpoint, environment variables for the client ID and secret and for Basic credentials, and startup checks (pro_tes/ga4gh/tes/backends.py: TokenProvider, TokenKey, get_env; pro_tes/security.py: check_backends). proWES needs the same (elixir-cloud-aai/prowes#120), and a second copy of a security-sensitive token client would have to be kept in sync by hand.

What to do

Move proTES's implementation into FOCA, generic over the API of the gateway:

  • A config model for the gateway's own client (as proTES's ClientCredentials: issuer or token_endpoint, scope, audience_parameter, auth_method, refresh_before, timeout, allowed URL schemes), placed next to the backend list config so gateways embed it under their key (e.g., custom.tes, custom.wes).
  • A token provider (client credentials grant, RFC 6749 section 4.4; cached per process and key, refreshed before expiry, one fetch per key at a time, cached token used while a refresh fails) whose client ID and secret come from environment variables the gateway names (e.g., PROTES_CLIENT_ID, PROWES_CLIENT_ID).
  • A resolver from a backend's auth to request credentials (Authorization header or a requests auth object): token (for the backend's audience, if configured), Basic from the named environment variables, or none; never .netrc, never the caller's headers.
  • Startup checks as in pro_tes/security.py (missing environment variables, http warnings, logging which backends get tokens), callable by any gateway.
  • proTES switches to it in a follow-up (issue in proTES after the FOCA release).

Done when

  • Unit tests of the provider (cache, refresh, concurrency, discovery, errors without secrets in messages) and of each credential mode, at 100% coverage.
  • Docs ("Backend lists" / plugins docs: credentials of backends), changelog.

Activity

  1. added this to the v0.23.0 milestone on Nov 18, 2026
  2. added
    priority: high
    status: triage
    type: auth
    workload: days
    on Nov 18, 2026
  3. added
    status: in progress
    on Nov 19, 2026
  4. self-assigned this
    on Nov 19, 2026
  5. removed
    status: triage
    on Nov 19, 2026
  6. moved this from Backlog to In progress in ELIXIR On-Cloud: Low Priorityon Nov 19, 2026
  7. moved this from In progress to In review in ELIXIR On-Cloud: Low Priorityon Nov 19, 2026
  8. removed
    status: in progress
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: hightype: authworkload: days

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions