Inhaltsverzeichnis

Single-Sign-On into Nextcloud using Admidio as an OpenID Provider

Starting with version 5.0, Admidio can be used by other applications to authenticate users against Admidio's user base. These instructions will guide you through the process of connecting Nextcloud to Admidio to use Admidio's login. For general instructions, and other apps, please visit the general Single-Sign-On overview page.

Nextcloud provides several apps that offer OpenID Connect login to Nextcloud:

App Homepage Comments
OpenID Connect user backend (user_oidc) Appstore, Homepage/Sourcecode Official OIDC app, supportsauto-discovery, supports groups, supports field mapping, supports auto-creation of user accounts on login.
OpenID Connect Login (oidc_login) Appstore, Homepage/Sorucecode Forked off sociallogin, configuration only via config file, no UI. Supports auto-discovery, supports groups, supports field mapping, supports auto-creation of user accounts on login.
Social Login (sociallogin) Appstore, Homepage/Sourcecode Targeted at providing login through social apps, allows generic OpenID Connect or OAuth login. No Auto-discovery. Supports groups. Creates its own usernames and groups, does not support accounts that were created locally or through other backends!

Prerequisites

Throughout the document we will assume you have both Admidio and Nextcloud already set up properly at https://admidio.local/ and https://nextcloud.local/. Please modify these URLs to your actual installation.

As a first step, one needs to configure Admidio to act as an OpenID Provider (OP). This has to be done once and is not specific to any particular client. Please folow this guide:

Basically, one needs to enable OpenID Connect (OIDC). The Issuer URL should in most cases be left blank, which means Admidio's public URL will be used as issuer URL.

The page https://admidio.local/adm_program/modules/preferences.php?panel=sso also provides the link to the automatic discovery URL, and the individual settings for clients that do not support auto-configuration via metadata.

Quick Overview

Setting up a client (OpenID „Relying Party“ = „RP“) to use Admidio's user accounts for log-in consists of two steps:

  1. The client (RP, Nextcloud in our case) needs to be set up with the data about the OpenID Provider (OP). If the plugin supports auto-discovery, paste the .well-known/openid-configuration URL from Admidio into the plugin config. Otherwise one has to manually paste the endpoint URLs of the OpenID provider. Since Admidio provides those URLs with copy buttons in the preferences screen, even the manual configuration is rather straightforward.
  2. Admidio needs to be told about the client. In particular, the entity ID and the redirect URL must be given, and a custom-generated (random) secret must be copied to the client configuration.

The concrete steps are:

Nextcloud Login via OpenID using the OpenID Connect user backend (user_oidc)

The most convenient OpenID Connect support for Nextcloud is provided by the „OpenID Connect user backend (user_oidc)“ plugin. It supports multiple OpenID Providers, support for groups, fields mapping, automatic user-creation on login and auto-discovery of settings. Its configuration is done in Nextcloud's preferences UI.

For convenient mapping of OIDC claims to Nextcloud profile fields, use the OIDC Claim Mapping plugin. To map admidio groups to Nextcloud groups in a visual style, use the OIDC Groups Mapping plugin.

Configuring the Service Provider (Nextcloud)

First, install the OpenID Connect user backend app in Nextcloud:

After installation it can be configured by an administrator in Nextcloud's preferences in the menu item „Administration“ → „OpenID Connect“.

The configuration of the provider in Nextcloud is now best done in parallel with the client configuration in Admidio.

Setting up the Client (SP) in Admidio

It is now a good idea to keep two browser windows open with Admidio and Nextcloud's configuration so one can easily select and copy the settings. Admidio even provides little „copy“ buttons/icons to copy the various settings to the clipboard for easy pasting into the Nextcloud configuration.

Return to Admidio's SSO preferences page, go to the „Single-Sign-On Client Administration“ (the button right below the endpoint URLs and above the „Save“ button), and create a new client.

After saving the changes (both in Nextcloud and Admidio), the apps should should now be set up for single-sign-on in Nextcloud.

Nextcloud Login via OpenID using the OpenID Connect Login app (oidc_login)

The „**OpenID Connect Login**“ plugin for Nextcloud provides OpenID login with support for groups, field mapping, automatic user-creation on login and auto-discovery of settings. Its configuration is done entirely in Nextcloud's config/config.php file, there is no graphical user interface.

The plugin supports some more settings (as described on its homepage), which you can insert as needed.

That's it, login via OpenID Connect should now be possible with Admidio's user accounts.

Nextcloud Login via OpenID using the Social Login app

Configuring the Service Provider (Nextcloud)

Nextcloud's **Social Login** plugin is distributed together with Nextcloud with the purpose of allowing login to Nextcloud using user accounts from social networks like Google, Facebook, Twitter, GitHub, etc. However, most of these use the OpenID Connect standard (or the OAuth 2.0 standard, on which OpenID is based), so it also allows generic OpenID providers to be used as login backend for Nextcloud.

One drawback of the sociallogin plugin compared to the user_oidc and oidc_login plugins described above is that the sociallogin plugin does not reuse existing user accounts and groups, but always creates custom accounts with the prefix configured for the account. This means that it is not possible for a local account to connect an OpenID account to log in to the existing account. Other plugins also use that approach for security reasons, but they allow turning off that behavior.

Setting up the Client (SP) in Admidio

It is now a good idea to keep two browser windows open with Admidio and Nextcloud's configuration so one can easily select and copy the settings. Admidio even provides little „copy“ buttons/icons to copy the various settings to the clipboard for easy pasting into the Nextcloud configuration.

Return to Admidio's SSO preferences page, go to the „Single-Sign-On Client Administration“ (the button right below the endpoint URLs and above the „Save“ button), and create a new client.

After saving the changes (both in Nextcloud and Admidio), the apps should should now be set up for single-sign-on in Nextcloud.

Setup completed, test Single-Sign-On

Admidio and Nextcloud should now be set up to use Admidio for logging in to Nextcloud. If you log out of Nextcloud and try to log in again, you will be shown the Admidio login screen and then redirected back to Nextcloud. The login buttons for each of the three possible OpenID plugins look very similar and work similar.

After successful login to Admidio, the user will be redirected back to Nextcloud and logged in.

Even though login looks idential for all three, internally, there are difference in how the login is registered.