Starting with version 5.0, Admidio can be used by other applications to authenticate users against Admidios user base. These instructions will guide you through the process of connecting GitLab to Admidio to use Admidio's login. For general instructions, and other apps, please visit the general Single-Sign-On overview page.
Throughout the document we will assume you have both Admidio and GitLab already set up properly at https://admidio.local/ and https://gitlab.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.
Setting up a client (OpenID “Relying Party” = “RP”) to use Admidio's user accounts for log-in consists of two steps:
The concrete steps are:
config/gitlab.rb config file.
OpenID Connect login in GitLab is provided out of the box without the need for additional extensions. Its configuration is done entirely in the config/gitlab.rb config file in the 'config/' directory of the GitLab installation.
There is a good documentation provided by the GitLab team, which is the basis for the example configuration shown here: https://docs.gitlab.com/administration/auth/oidc/.
config/gitlab.rb configuration file of GitLab and append the following lines to the end of the file:gitlab_rails['omniauth_providers'], and optionally include all single-sign-on methods to the 'omniauth_allow_single_sign_on' list.gitlab_rails['omniauth_enabled'] = true gitlab_rails['omniauth_allow_single_sign_on'] = ['openid_connect'] gitlab_rails['omniauth_auto_link_user'] = true gitlab_rails['omniauth_block_auto_created_users'] = false gitlab_rails['omniauth_sync_profile_attributes'] = true gitlab_rails['omniauth_sync_profile_from_provider'] = ['saml', 'openid_connect'] gitlab_rails['omniauth_providers'] = [ { name: "openid_connect", label: "Admidio via OpenID", icon: "https://www.admidio.org/images/favicon-16x16.png?v=2", groups_attribute: "roles", args: { # name: "openid_connect", scope: ["openid","profile","email", "groups", "custom", "phone", "address"], response_type: "code", issuer: "https://admidio.local/modules/sso/index.php/oidc", discovery: true, client_auth_method: "query", uid_field: "username", send_scope_to_token_endpoint: "true", pkce: true, client_options: { identifier: "https://gitlab.local/", secret: "VMjNB7vFAeb1dmMSFpjcyz27i24Ytti7", redirect_uri: "https://gitlab.local/users/auth/openid_connect/callback" } } } ]
It is now a good idea to keep two browser windows open 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 GitLab's configuration.
Now, 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.
https://[YOUR_GITLAB]/. The client secret is randomly generated and must be copied exactly to the GitLab configuration, as it will serve like a password. Admidio will create one and allow it to be copied to the client. Afterwards it is only stored as a hash in the database and can not be recovered any more. However, one can create a new Client Secret in Admidio and copy that to the client's configuration.https://[YOUR_INSTALLATION]/index.php/Special:PluggableAuthLogin. Enter that URL in Admidio's client config.This is a typical configuration of the GitLab OpenID client in Admidio:
The clientID and the client secret in the Admidio client page and GitLab's config/gitlab.rb have to match exactly. Similarly, the scopes should coincide, otherwise not all desired profile fields will be transmitted. To make use of the group mapping in GitLab (see the Gitlab documentation for details), make sure to include the 'groups' scope in Admidio and GitLab, and map the 'Roles - roles' Profile Field to an OIDC claim.
Admidio and GitLab should now be set up to use Admidio for logging in to GitLab. If you log out of GitLab (or open a new incognito browser window) and try to log in again, the login form with have an additional button (with the label given in the config file) to initiate an OpenID login. If you click it, you will be shown the Admidio login screen (if you are not already logged in) and then redirected back to GitLab after successful login.