Diagnose and fix OIDC authentication in Medulla
Applies to: Medulla Server
Environment: On-Premise / OpenID Connect (OIDC) SSO authentication
Directories: Active Directory, OpenLDAP, FreeIPA, 389 Directory Server, and other LDAP directories compatible with the identity provider
OIDC providers: LemonLDAP::NG, Keycloak, Microsoft Entra ID, Authentik, Okta, and other compatible OIDC providers
Tool: test_oidc_medulla.sh
Category: Authentication / SSO / Diagnostics
Updated: November 2026
1. Overview
Medulla can use an external identity provider (IdP) to authenticate users using the OpenID Connect (OIDC) protocol.
This configuration allows for centralized user authentication and the use of an existing SSO system.
The identity provider itself can rely on various directory systems:
- Microsoft Active Directory.
- OpenLDAP.
- FreeIPA.
- 389 Directory Server.
- A compatible LDAP or LDAPS directory.
- A federated identity service or a cloud directory.
Medulla does not need to know the directory’s structure directly when authentication is performed via OIDC. The identity provider is responsible for authenticating the user and passing the necessary information to Medulla.
Important: LDAP and OIDC are two distinct protocols. The script presented here diagnoses an OIDC connection. It does not replace a direct LDAP or LDAPS diagnostic tool. For an LDAP directory, an identity provider that acts as a gateway to OIDC is required.
2. Understand how authentication works
2.1. General architecture
Utilisateur
|
v
Interface Web Medulla
|
| Redirection OIDC
v
Fournisseur d'identité (IdP)
|
| Authentification
v
Annuaire ou service d'identité
|
| Validation de l'utilisateur
v
Fournisseur d'identité
|
| Authorization Code
v
Medulla
|
| Token Endpoint
| UserInfo Endpoint
v
Provisionnement du compte
|
v
Application des droits Medulla
The identity provider can authenticate the user using a password, an existing SSO session, multi-factor authentication, or any other mechanism it supports.
Once authentication is accepted, Medulla retrieves the user’s information using the OIDC protocol.
2.2. Division of responsibilities
| Component | Responsibility |
|---|---|
| LDAP/Active Directory directory | Storage and management of accounts, attributes, and groups according to the chosen architecture. |
| Identity provider | Authentication, access rules, MFA, and issuance of OIDC information. |
| Medulla | Receiving the OIDC response, retrieving attributes, provisioning the account, and applying ACLs. |
3. Overview of the diagnostic tool
The test_oidc_medulla.sh script analyzes Medulla’s OIDC configuration and verifies the key elements required for its operation.
In particular, it checks:
- The OIDC provider configuration.
- DNS resolution and HTTPS communications.
- TLS certificates.
- The OIDC discovery document.
- The authorization, token, and user information endpoints.
- Client ID and Client Secret.
- The Redirect URI.
- The claims required by Medulla.
- Provisioning and ACL configuration.
- Errors in the Medulla logs.
An optional test using a user account also allows you to reproduce part of the full authentication process.
How it works: The script reads the Medulla configuration and performs diagnostic requests. It does not modify Medulla settings or create any user accounts.
4. Prerequisites
The script must be run directly on the Medulla server with sufficient privileges to access its configuration and database.
The required tools are:
bashcurljqopensslpython3mysql
On Debian:
apt update
apt install -y curl jq openssl python3 default-mysql-client
The server must be able to connect to the identity provider via HTTPS, either directly or through the proxy specified in Medulla’s OIDC configuration.
5. Download and install the script
The script is available on the official Medulla download server:
Connect to the Medulla server via SSH, then run:
cd /root
wget https://dl.medulla-tech.io/ma/test_oidc_medulla.sh
chmod +x test_oidc_medulla.sh
bash -n test_oidc_medulla.sh
The bash -n command checks the script’s Bash syntax without executing it.
6. Identify the configured OIDC providers
To display the providers registered in Medulla:
sudo ./test_oidc_medulla.sh
The script queries the admin.providers table and displays:
- The name of the Medulla client (
client_name). - The name of the OIDC provider.
- The Issuer URL.
- The Client ID.
The exact name of the provider must be used in the following commands.
7. Run a diagnostic
7.1. Diagnostic without a user account
sudo ./test_oidc_medulla.sh "OIDC"
Upon startup, the script prompts you to enter a username.
Press Enter without entering a username to perform only the technical checks.
This mode allows you to verify the OIDC configuration, certificates, network, endpoints, and Medulla settings.
7.2. Diagnostic with a user account
sudo ./test_oidc_medulla.sh -u utilisateur.test "OIDC"
The script prompts for the account password without displaying it on the screen.
It then attempts to perform the following steps:
- Accessing the identity provider.
- Loading the login form.
- Submitting the credentials.
- Applying the provider’s access rules.
- Returning to Medulla’s Redirect URI.
- Exchanging the authorization code for a token.
- Querying the
userinfoendpoint. - Checking the received attributes.
- Simulating Medulla provisioning and ACLs.
Limitation: The script does not support all interactive authentication mechanisms. MFA authentication, user consent, a complex JavaScript portal, or Kerberos integrated authentication may require additional testing in a browser.
7.3. Select a Medulla client
sudo ./test_oidc_medulla.sh -c MMC "OIDC"
The -c parameter is used to select the client_name. The default value is MMC.
7.4. Available parameters
| Parameter | Description |
|---|---|
-c |
Name of the Medulla client; the default is MMC. |
-u |
Login for the account used for the actual test. |
-h |
Displays script usage information. |
OIDC_TEST_PASSWORD |
Environment variable used to provide the password without interactive input. |
Security: Always use interactive password entry whenever possible. Avoid storing passwords in plain text in commands, scripts, or shell histories.
8. Understand the results
| Status | Meaning | Recommended action |
|---|---|---|
| OK | Check passed. | No correction needed for the verified item. |
| WARN | Warning or further verification required. | Review the recommendation. |
| KO | Error detected. | Apply the indicated correction. |
Upon completion, the script displays a summary of the checks and a list of recommended corrections.
Important: A result with no KO does not guarantee that all users can log in. The provider’s access rules and the attributes actually transmitted must be verified using an authorized account.
9. Checks performed by the script
9.1. Medulla configuration
The script queries the admin.providers table and the following files:
/etc/mmc/mmc.ini
/etc/mmc/mmc.ini.local
/etc/mmc/plugins/base.ini
/etc/mmc/plugins/base.ini.local
In particular, it checks:
- The Issuer URL.
- The Client ID and Client Secret.
- Any proxy.
- The OIDC claim mappings.
- The default ACLs.
- Mappings between roles and ACLs.
- The Redirect URI.
- The OIDC provisioning method.
9.2. Network and certificates
The script checks:
- DNS resolution for the identity provider.
- HTTPS connectivity.
- The TLS trust chain.
- Certificate validity.
- Whether the certificate matches the DNS name.
- Connectivity from PHP/cURL.
- Clock synchronization.
9.3. OIDC discovery
The OIDC discovery document is generally accessible at the following address:
https://idp.exemple.fr/.well-known/openid-configuration
The script checks:
- The issuer’s consistency.
- Endpoint availability.
- Support for the Authorization Code flow.
- The advertised scopes.
- The declared claims.
- Availability of the JWKS document.
9.4. Client ID and Client Secret
The script tests the client's authentication methods:
client_secret_basicclient_secret_post
It sends a deliberately invalid authorization code to the token endpoint.
An invalid_grant response may indicate that the client’s authentication was accepted and that only the authorization code was rejected, in accordance with expected behavior.
An invalid_client or unauthorized_client response requires verification of the OIDC client and its authentication method.
10. Compatibility with LDAP directories
Compatibility with a directory depends primarily on the identity provider used and its ability to pass the necessary attributes to the OIDC protocol.
| Directory or identity system | Use with Medulla OIDC | Point to note |
|---|---|---|
| Microsoft Active Directory | Via an OIDC provider connected to Active Directory. | Mapping between sAMAccountName, UPN, and OIDC identifier. |
| OpenLDAP | Via an OIDC provider connected to OpenLDAP. | Mapping of the uid, cn, givenName, sn, and mail attributes. |
| FreeIPA | Via an OIDC provider compatible with the FreeIPA directory. | Stable identifier, groups, and exported attributes. |
| 389 Directory Server | Via an OIDC provider connected to the directory. | Mapping of LDAP attributes to OIDC claims. |
| Microsoft Entra ID | Via the OIDC protocol. | Availability of claims in userinfo, and client configuration. |
| Other LDAP directories | Via an identity provider supporting OIDC federation. | Provider compatibility and attribute mapping. |
Principle: Medulla processes the OIDC claims transmitted by the identity provider. The names of LDAP attributes may vary depending on the directory without requiring any modification to the OIDC protocol used by Medulla.
11. Mapping of LDAP and OIDC attributes
The identity provider must transmit the information necessary for identifying users and provisioning Medulla accounts.
| Medulla attribute | Default OIDC claim | Examples of LDAP sources |
|---|---|---|
uid |
preferred_username |
uid, sAMAccountName, userPrincipalName, or stable identifier. |
givenName |
given_name |
givenName. |
sn |
family_name |
sn. |
mail |
email |
mail or email address defined in the directory. |
Mappings can be customized in:
Administration → Authentication Configuration → OIDC → Edit
11.1. Example with Active Directory
An identity provider connected to Active Directory can use the following mappings:
| Active Directory attribute | OIDC claim |
|---|---|
sAMAccountName |
preferred_username |
givenName |
given_name |
sn |
family_name |
mail |
email |
These mappings are examples. Their availability depends on the OIDC provider’s configuration.
11.2. Example with OpenLDAP
| OpenLDAP attribute | OIDC claim |
|---|---|
uid |
preferred_username |
givenName |
given_name |
sn |
family_name |
mail |
email |
11.3. Choose a stable identifier
It is recommended to use an identifier that does not change during the account’s lifetime.
An email address can be used, but a change in the email address may result in the creation of a second Medulla account if it is used as the identifier.
Caution: The sub claim is a stable OIDC identifier at the provider level, but it must not be automatically substituted for uid. Verify its value and compatibility with the Medulla provisioning mechanism before modifying the mapping.
12. Fix the most common errors
12.1. The provider rejects the user
Symptoms:
- The authentication form appears.
- The user enters their credentials.
- The provider displays an access denial.
- There is no redirection to Medulla.
Possible causes:
- Account not authorized to access the OIDC client.
- Access rule based on an LDAP attribute.
- Membership in a non-compliant group.
- Account is disabled or not recognized by the provider.
- The provider’s authentication policy has not been met.
Solution: Check the identity provider’s authorization rules and the account’s attributes in the directory.
12.2. Redirect URI rejected
Medulla’s Redirect URI is constructed according to the following format:
https://medulla.exemple.fr/mmc/providers.php
It depends, in particular, on the FQDN declared in the [server_01] section of the MMC configuration.
[server_01]
description = medulla.exemple.fr
The identity provider must authorize exactly the same redirect address.
Caution: Some providers only verify the Redirect URI after authentication. A diagnostic test without an account may therefore not be sufficient.
12.3. Missing user attribute
If an expected attribute is missing from the userinfo response, Medulla may not have the information needed to provision the account.
Verify:
- That the attribute exists in the directory.
- That it is accessible to the identity provider.
- That it is exported in the OIDC claims.
- That its name matches the mapping configured in Medulla.
12.4. The user does not have the expected permissions
The OIDC provider may apply a default ACL.
Example:
base#main#default/
This ACL grants access only to the home page.
An administrator must assign the necessary permissions or configure a mapping between OIDC roles and Medulla ACLs.
Caution: ACLs may be reapplied with each OIDC login. Verify permissions after re-authentication.
12.5. OIDC provisioning denied
If an authonly restriction is present in the authentication configuration, verify that oidc is included in the provisioning methods.
File:
/etc/mmc/plugins/base.ini.local
Example:
[provisioning]
method = oidc glpi
After modification:
systemctl restart mmc-agent
Note: Keep the other provisioning methods already present in the configuration.
12.6. Unrecognized TLS certificate
If the provider’s certificate is signed by an internal certificate authority, install the necessary certificates in the Medulla server’s trust store.
cp autorite-interne.crt /usr/local/share/ca-certificates/
update-ca-certificates
Do not disable TLS validation to work around a certificate issue.
12.7. Multi-factor authentication or consent
The script may detect an MFA page or a consent request but be unable to automatically complete the flow.
In this case, perform the validation in a browser using an authorized account.
13. Example of an anonymized diagnostic
A diagnostic test was performed on a Medulla server using an OIDC provider connected to a corporate directory.
The results of the technical checks were:
OK : 17
KO : 0
The following elements were validated:
| Element | Result |
|---|---|
| Issuer URL | https://idp.exemple.fr, complies with the declared issuer. |
| OIDC discovery | Accessible from the shell and PHP. |
| IdP certificate | Valid and recognized certificate. |
| Client ID / Secret | Accepted by the token endpoint. |
| Redirect URI | https://medulla.exemple.fr/mmc/providers.php |
| Medulla certificate | DNS name covered by the certificate. |
| Login page | OIDC button present. |
| Provisioning | oidc method present. |
| Clock | NTP synchronization is correct. |
| OIDC library | OIDC PHP library installed. |
Identified blockage
After the credentials are entered, the identity provider displays an authorization denial.
Accès non autorisé pour cet utilisateur
The user is not redirected to Medulla.
The block therefore occurs before the user is redirected back to the application.
Recommended actions:
- Check the OIDC client’s access rules and the user’s attributes or groups.
- Confirm authorization of the Redirect URI
https://medulla.exemple.fr/mmc/providers.php. - Check the attributes exported in
userinfo. - Run a full test again using an authorized account.
Conclusion: The absence of errors in technical checks does not mean that the user flow is functional. When the provider rejects the user before redirection, the provider’s access rules must be examined as a priority.
14. Review the Medulla logs
The main logs are:
/var/log/apache2/error.log
/var/log/mmc/mmc-agent.log
To track OIDC-related events:
tail -F /var/log/apache2/error.log /var/log/mmc/mmc-agent.log | grep -iE --line-buffered "oidc|oauth|openid|exception"
Interpretation:
- Error displayed before returning to Medulla: check the identity provider.
- Error after returning to Medulla: check Apache, MMC, and the OIDC attributes.
- Login successful but insufficient permissions: check provisioning and ACLs.
15. Diagnostic report
The script saves a text report in /tmp.
Example:
/tmp/oidc_report_OIDC_20261112-120000.txt
The report contains:
- Environment information.
- OIDC parameters useful for diagnostics.
- OK, WARN, and KO checks.
- Issues and recommended fixes.
- Remaining manual checks.
- Claims received when a user test is performed.
The script is designed not to display the Client Secret, password, or authentication tokens in the report.
Confidentiality: The report may contain personal data and information about the infrastructure. It must be reviewed before transmission and shared only with authorized individuals. File permissions must also be checked.
16. Frequently asked questions
Does the script work with Active Directory?
Yes, if Active Directory is used behind a compatible OIDC identity provider. The script tests the OIDC chain between Medulla and that provider, but does not directly test the LDAP connection to Active Directory.
Does the script work with OpenLDAP?
Yes, based on the same principle: an identity provider must expose OpenLDAP accounts via OIDC. The script does not establish a direct LDAP connection.
Do I need to use the same LDAP attributes with all directories?
No. LDAP attributes may differ. The identity provider must convert them into OIDC claims that correspond to the mapping expected by Medulla.
Why is there no OIDC trace in Medulla?
If the provider blocks the user before redirection, Medulla does not receive the OIDC response. In this case, you must examine the provider’s access rules and logs.
The diagnostic shows 0 KO, but the login fails. Why?
Technical checks may pass even if an access rule denies a user. Perform a test using an authorized account.
Can an email address be used as an identifier?
Yes, if the OIDC mapping is configured for this. However, changing the email address may result in the creation of a second account.
Why does a user only have access to the home page?
The default ACL may be restricted to base#main#default/. You must assign additional permissions or configure a role mapping.
Do LDAP groups automatically grant permissions in Medulla?
No. Groups must be processed by the identity provider and transmitted in a format compatible with Medulla’s role and ACL configuration.
The role mapping mechanism must be configured and verified. In particular, the script checks the profiles_order and acls_json parameters and simulates the roles received via realm_access.roles during the user test.
Does logging out of Medulla end the SSO session?
Not necessarily. The identity provider session may remain active after logging out of Medulla.
Does the script modify LDAP accounts?
No. It does not modify LDAP accounts or Medulla accounts. It performs checks and simulates provisioning.
Does the script allow you to diagnose LDAPS on port 636?
No, not directly. The script tests OIDC communications over HTTPS. To diagnose LDAP or LDAPS between the identity provider and the directory, use the tools appropriate for that directory and its environment.
Is the script compatible with all OIDC providers?
It can check the main standardized OIDC elements. However, some providers use specific login mechanisms, claim formats, or policies that require additional verification.
17. Recommended diagnostic procedure
- Identify the OIDC provider configured in Medulla.
- Verify network connectivity and certificates.
- Run the standard diagnostic test.
- Correct any configuration errors.
- Verify the OIDC client configuration at the identity provider.
- Verify the mapping between directory attributes and OIDC claims.
- Run the diagnostic test again using an authorized account.
- Verify the Redirect URI and the attributes returned by
userinfo. - Perform an actual login to Medulla.
- Verify the permissions granted after logging in and logging back in.
- Save the diagnostic report for support follow-up.
Recommended command:
sudo ./test_oidc_medulla.sh -u utilisateur.test "OIDC"
18. Summary
The test_oidc_medulla.sh script allows you to diagnose the OpenID Connect authentication chain between Medulla and an external identity provider.
It can be used in environments based on Active Directory, OpenLDAP, FreeIPA, or other LDAP directories, provided that a compatible OIDC provider handles authentication and transmits the necessary attributes.
It helps distinguish between Medulla configuration issues, network or TLS anomalies, identity provider errors, and account provisioning difficulties.
Key takeaway: To diagnose SSO authentication, you must distinguish between three levels: the directory that contains the accounts, the identity provider that authenticates users, and Medulla, which receives the OIDC information and applies permissions. The script primarily diagnoses communication between Medulla and the OIDC provider.