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 Mailman3 to Admidio to use Admidio's login. For general instructions, and other apps, please visit the general Single-Sign-On overview page.
Mailman3 provides OpenID Connect login out of the box using the django-allauth library.
Throughout the document we will assume you have both Admidio and Mailman3 already set up properly at https://admidio.local/ and https://mailman.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:
https://[YOUR_MAILMAN]/accounts/[PROVIDER_ID]/login/callback/.
Although Mailman3 already provides the OpenID login functionality, the corresponding backend needs to be enabled in the /opt/mailman-web/settings_local.py:
MAILMAN_WEB_SOCIAL_AUTH = [
'allauth.socialaccount.providers.openid_connect',
]
Also make sure the /opt/mailman-web/urls.py contains the correct routes to the allauth plugin (usually this should already be set up):
urlpatterns = [ ... path(r'accounts/', include('allauth.urls')), ... ]
The OpenID Provider can be configured in Mailman3 either textually in the /opt/mailman-web/settings_local.py configuration file or via the graphic Django UI available at https://[YOUR_MAILMAN]/admin/. Both methods are equivalent. If you set up two (even identical) providers, an error message about duplicate objects will be triggered ('MultipleObjectsReturned at /accounts/login/').
https://[YOUR_MAILMAN]/admin/ and log in as Mailman admin.
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.
The settings in Mailman3's and Admidio's OpenID setup need to match. Most of the settings can be copied over from Admidio to Mailman3 or vice versa:
{"server_url": "[DISCOVERY_URL]"}
https://[YOUR_MAILMAN]/accounts/[PROVIDER_ID]/login/callback/
„oauth_pkce_enabled“: true setting is only one part. The overall PKCE enablement must be done in settings_local.py: # PKCE must be configured here, not in the "Settings" field in the Django admin. # Note: no "APPS" key here on purpose -- the app is configured in the Django admin, and # declaring it in both places makes allauth fail with multiple matching apps. SOCIALACCOUNT_PROVIDERS = { "openid_connect": { "OAUTH_PKCE_ENABLED": True, } }
After saving the changes (both in Mailman3 and Admidio), the apps should should now be set up for single-sign-on in Mailman3.
Rather than the graphic setup in django's admin backend, one can also setup the OpenID provider in Mailman's settings_local.py. The corresponding entry to the above example is:
SOCIALACCOUNT_PROVIDERS = {
"openid_connect": {
"OAUTH_PKCE_ENABLED": True,
"APPS": [
{
"provider_id": "admidio",
"name": "OpenID via Admidio",
"client_id": "https://mailman.local/",
"secret": "zfHdTe2nFqg4HyM/18fcyxTmpxTVk4L9",
"settings": {
"server_url": "https://admidio.local/modules/sso/index.php/oidc/.well-known/openid-configuration",
"token_auth_method": "client_secret_post",
"oauth_pkce_enabled": True,
},
},
]
}
}
In this example, the pkce and token_auth settings are optional. For a list of all available options see the django-allauth documentation.
Admidio and Mailman3 should now be set up to use Admidio for logging in to Mailman3. If you log out of Mailman3 (or open an incognito browser window) and try to log in again, you will be shown the Admidio login screen and then redirected back to Mailman3 after a successful login.
If a new account is created, one is asked to confirm the email adress.
On a successfull login, the connection to the OpenID account will be stored in the user profile. For existing Mailman users, one can connect the mailman account with an OpenID account in the profile, too:
settings_local.py) all OpenID providers except for one.