Skip to content

Add OIDC / external authentication support for OpenEMS Edge UI #3960

Description

@Christoph-87

Component

Edge

Description

Use case

I run OpenEMS Edge in a self-hosted environment and would like to use an external identity provider, in my case Authentik, as the primary authentication mechanism for the OpenEMS UI.

Instead of using the built-in OpenEMS Edge password login page, I would like users to authenticate through Authentik/SSO and then be logged into OpenEMS automatically.

For a home or small commercial installation, this would make it possible to manage access centrally in the identity provider, avoid sharing or managing a separate OpenEMS Edge password, and integrate OpenEMS into an existing self-hosted SSO setup.

Current behavior

OpenEMS appears to have OAuth/OIDC-related authentication support for OpenEMS Backend, but the Edge UI / Edge WebSocket authentication path seems to only support local password/token based authentication.

In an Edge-only deployment, OIDC cannot currently be enabled just by configuration.

Desired behavior

OpenEMS Edge should support an external authentication mechanism, so that users who are already authenticated by an identity provider can be logged into the OpenEMS UI automatically.

Possible approaches could be:

Option 1: Native OIDC support for OpenEMS Edge

Add OIDC login support to OpenEMS Edge, similar in spirit to the existing backend OAuth/OIDC support.

Useful configuration options could include:

  • OIDC issuer URL / discovery URL
  • client ID
  • client secret, if needed
  • redirect URI
  • scopes
  • claim mapping for username/display name
  • group or role mapping to OpenEMS roles
  • logout behavior

This would allow providers such as Authentik, Keycloak, Authelia, Zitadel, etc. to be used directly.

Option 2: Trusted reverse proxy authentication

Alternatively, OpenEMS Edge could support a trusted reverse proxy authentication mode.

In this model, an external proxy or identity provider outpost authenticates the user and forwards identity headers to OpenEMS, for example:

  • X-authentik-username
  • X-authentik-email
  • X-authentik-groups

OpenEMS Edge would only trust these headers when the request comes from explicitly configured trusted proxy IPs or networks.

Useful configuration options could include:

  • enable/disable external header authentication
  • trusted proxy IPs/CIDRs
  • header names for username/email/groups
  • mapping from external groups to OpenEMS roles
  • fallback behavior for local password login

Security considerations

If reverse proxy header authentication is implemented, it should be disabled by default and only work when trusted proxy addresses are explicitly configured. OpenEMS should never blindly trust authentication headers from arbitrary clients.

OIDC would probably be the cleaner general-purpose solution, while trusted proxy authentication may be simpler for self-hosted deployments that already rely on Authentik/Authelia/Traefik.

Why this would be useful

This would make OpenEMS easier to integrate into existing self-hosted identity setups and avoid maintaining a separate OpenEMS password for every user.

It would also allow access control to be managed centrally through the identity provider, while OpenEMS continues to enforce its own roles/permissions internally.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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