Casdoor集成市场

Nextcloud | 应用集成

Nextcloud 单点登录

Nextcloud's OpenID Connect user backend app (user_oidc) creates Nextcloud accounts from an OpenID Connect provider. With Casdoor as the provider, people sign in to Nextcloud with their Casdoor account, and their Casdoor groups become Nextcloud groups.

Casdoor 官方核验OIDC群组同步
你需要一个正在运行的 Casdoor,自己部署或用 Casdoor 云都可以。示例中的 https://auth.example.com 请换成你的 Casdoor 地址(Casdoor 云上类似 https://acme.casdoor.com),其他 example.com 地址也换成你自己的。

用 Casdoor 配置 Nextcloud

  1. 1

    在 Casdoor 中注册 Nextcloud

    在 Casdoor 控制台打开 应用,为 Nextcloud 添加一个应用,在它的 OIDC/OAuth 标签页复制 客户端ID 和 客户端密钥。把下面的地址加到 重定向URLs:

    • https://cloud.example.com/apps/user_oidc/code

    If your Nextcloud URLs include /index.php, use https://cloud.example.com/index.php/apps/user_oidc/code instead. 要用群组的话,先在应用所属的组织里创建群组(例如 family or finance)并加入用户,再在同一个标签页把 Token 中的群组格式 设成 Name,这样令牌里是 family,而不是 <组织>/family。

  2. 2

    Install the OpenID Connect app

    Install OpenID Connect user backend from the Nextcloud app store, or with occ:

    sudo -u www-data php occ app:install user_oidc
  3. 3

    Add Casdoor as a provider

    Run this from the Nextcloud directory. It names the provider Casdoor, maps Nextcloud user IDs to Casdoor usernames instead of hashes, and creates Nextcloud groups from the groups claim.

    sudo -u www-data php occ user_oidc:provider Casdoor \
      --clientid="<client ID>" \
      --clientsecret="<client secret>" \
      --discoveryuri="https://auth.example.com/.well-known/openid-configuration" \
      --scope="openid email profile" \
      --unique-uid=0 \
      --mapping-uid=name \
      --mapping-display-name=displayName \
      --mapping-email=email \
      --mapping-groups=groups \
      --group-provisioning=1
  4. 4

    Sign in

    The Nextcloud login page now has a Log in with Casdoor button. To send everyone straight to Casdoor, turn off the other login methods; administrators can still reach the normal login form by adding ?direct=1 to the login URL.

    sudo -u www-data php occ config:app:set --type=string --value=0 user_oidc allow_multiple_user_backends

注意事项

  • The mappings above read Casdoor's default ID token, where name is the username and displayName the display name. If you switch the application's Token format to JWT-Standard, map the user ID to preferred_username and the display name to name instead; that format doesn't include groups.
  • Without --unique-uid=0, Nextcloud stores each user under a hash of the provider and user ID, which is safe with several providers but hard to read.

Nextcloud 的设置取自它的官方文档(核对于 2026年10月:Nextcloud user_oidc);另见Casdoor 文档。Nextcloud 是其所有者的商标。

常见问题

Does it work with the Nextcloud desktop and mobile apps?

Yes. The apps sign in through the browser using Nextcloud's login flow, which shows the same Log in with Casdoor button.

Can I use LDAP instead?

Casdoor also runs an LDAP server that Nextcloud's LDAP app can use. OpenID Connect is simpler to set up, and it keeps Casdoor's MFA, passkeys and social logins in the sign-in.