Skip to content

feat: log in with an OIDC provider - #273

Draft
DavidePrincipi wants to merge 3 commits into
mainfrom
feat-8080
Draft

DavidePrincipi wants to merge 3 commits into
mainfrom
feat-8080

Conversation

@DavidePrincipi

@DavidePrincipi DavidePrincipi commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Let Nextcloud users log in with single sign-on (SSO) through an OpenID Connect (OIDC) provider, like the Keycloak realm of their user domain in the new idp module, as part of NethServer/dev#8080.

When OIDC is configured, the Nextcloud login page offers the provider login, and an OIDC login opens the existing LDAP account of the user: no new account is created. Without OIDC settings nothing changes. For now the settings are written by hand: discovery of the provider comes later.

  • New setup-oidc script, run at every start of the app service: it enables and configures the user_oidc app, or disables it without settings
  • The ldap_uuid claim of the token is the Nextcloud user ID, and the LDAP login filter also matches the account UUID
  • Secrets in state/oidc.env (OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET), mode 0600 and included in the backup; the login mode in the module environment: OIDC_LOGIN_MODE=optional shows the Nextcloud form with the SSO button, exclusive goes straight to the provider, with /login?direct=1 as emergency password login. All documented in the README, together with the logout URI to register

How to test

  • Register a client for the Nextcloud module with the register-client action of the idp module, and write its credentials to state/oidc.env as the README shows
  • Restart the Nextcloud app service, then open the Nextcloud login page and log in through the provider
  • Check that the login opens the existing account of an LDAP user, with no new account created, and that logout returns to Nextcloud
  • Set OIDC_LOGIN_MODE=exclusive, restart, and check that the login page goes straight to the provider, while /login?direct=1 still shows the password form
  • Remove state/oidc.env, restart, and check that the password login works as before

See also


Generated by Claude Code:claude-opus-5-5 with nethserver-pr

When the oidc.env file of the module state holds the issuer and the
client credentials, the app service start configures the user_oidc app:
the login page offers the OIDC provider next to the password form, or
redirects to it.

The ldap_uuid claim is the Nextcloud user ID, as user_ldap assigns it,
so OIDC logins map to the existing LDAP accounts and no other account
is created. The LDAP login filter also matches the UUID: user_oidc uses
it to resolve users not mapped by user_ldap yet, who otherwise could
not log in at the first try.

The settings are written manually for now: provider discovery comes
later. The file is part of the backup, because it holds the client
secret.

Assisted-by: Claude Code:claude-opus-5-5
@DavidePrincipi DavidePrincipi self-assigned this Oct 2, 2026
@DavidePrincipi DavidePrincipi changed the title Log in with an OIDC provider feat: log in with an OIDC provider Oct 2, 2026
The OIDC provider refused the redirect back to Nextcloud after the
logout, because the client had no post-logout redirect URI. Set the
post-logout URI of the user_oidc provider to the Nextcloud home page
explicitly, and register the same URI in the README example.

Assisted-by: Claude Code:claude-opus-5-5
OIDC_LOGIN_MODE in the module environment replaces the boolean in the
secrets file. optional keeps the password form next to the SSO button,
exclusive sends the login page straight to the provider; an unknown
value works as optional, with a warning. The provider name moves to
the module environment too: oidc.env keeps only the client secrets.

The README documents the emergency password form at /login?direct=1,
the access that keeps using LDAP passwords, and why a realm that
accepts only federated logins needs the exclusive mode.

Assisted-by: Claude Code:claude-opus-5-5

This branch has not been deployed

No deployments
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.

1 participant