Skip to content

Conversation

@inimaz
Copy link
Collaborator

@inimaz inimaz commented Dec 7, 2025

Description

Instead of using directly Fief, we can pass an auth_provider interface that uses OIDC and points to Fief.

Two main gains:

  1. Like this migrating to other auth providers will be easier. If they use OIDC, update the env vars. If they do not use OIDC they will need to implement the auth_provider interface.
  2. We can use this interface as well to provide a no-authentication provider 😄 . See
    carbonserver/carbonserver/api/services/auth_providers/no_auth_provider.py, for testing purposes. This will allow the UI in local to be easier to test/develop.

Related to #861

@inimaz inimaz requested a review from prmths128 December 7, 2025 13:12
@prmths128
Copy link
Contributor

do we need multiple auth providers ?
the short term issue is not the fief server but the reliance on custom libs instead of generic oidc
i'd suggest instead keeping the fief server for the moment but switching the fief libs to fastapi_oidc on the back and next-auth on the front might
and then using another oidc server

@inimaz
Copy link
Collaborator Author

inimaz commented Dec 10, 2025

do we need multiple auth providers ?

Thanks for the comment @prmths128 ! I agree we won't need 2 auth providers ever at the same time. On the other hand if we can implement the fastapi_oidc so that the server is injected and easily plugable? Like that for local dev we inject a mock and it is easier to work with it. What do you think?

@inimaz inimaz marked this pull request as ready for review January 10, 2026 17:00
@inimaz inimaz requested a review from a team as a code owner January 10, 2026 17:00
@inimaz inimaz changed the title feat: allow any authentication provider feat: allow any authentication provider + fief OIDC Jan 10, 2026
Copy link
Member

@SaboniAmine SaboniAmine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

) # Options: 'oidc', 'fief' (deprecated), 'none'

# OIDC settings (with backward compatibility for Fief environment variables)
oidc_client_id: str = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets maybe source from env vars with default values ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is in the config part. I did it like this because we need to still read the FIEF_... env vars.

So in this configuration:
https://github.com/mlco2/codecarbon/pull/999/changes#diff-24a79c91033797e992d55fd4eddbcda1cff587119f27fe3cd7d2c739bb616ab8R43

The precedence is:

  • First checks OIDC_CLIENT_ID
  • If not found, then checks FIEF_CLIENT_ID
  • If neither found, uses the default value (empty string "")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants