Table of Contents

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 Nextcloud. Please follow this guide: #a_basic_setup_for_admidio_as_an_oidc_id_provider

Basically, one (1) needs to create a cryptographic key to sign message and choose a unique EntityID. The page https://admidio.local/adm_program/modules/preferences.php?panel=sso also provides the link to the metadata xml, and the individual settings in case a client does not support auto-configuration via metadata.

Quick Overview

Setting up a client (OpenID “Relying Party” - short RP) to use Admidio's user accounts for logging 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. Otherweise, one has to manually paste the endpoint URLs of the OpenID provider. Admidio provides copy buttons in the preferences screen, so this 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 preferencess UI.

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”.

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.