Integrate your existing Single-Sign-On (SSO) solution using the SAML protocol and provide your users with a convenient way to log in.
This module integrates HumHub with a SAML 2.0 Identity Provider (IdP) so your users can sign in via Single Sign-On.
Since version 2.4.0, standard SAML claims (id, email, username, firstname, lastname) are auto-detected from a curated list of common attribute names — LDAP OIDs, ADFS / SOAP schemas, Microsoft / Azure AD claims, raw shortnames. No manual attribute mapping is needed for the default fields. Use the Attribute mapping setting only to override the auto-detection or to map custom profile fields. See Attribute auto-detection for the exact lookup order.
For each standard field, HumHub checks the attribute names below in the listed order and uses the first one that is present in the SAML assertion with a non-empty value. Multi-valued attributes are reduced to their first value.
Rules:
username=...) always wins and disables the auto-detection for that field, even if the mapped attribute is missing from the assertion. Remove the line to re-enable the auto-detection.username=urn:oid:0.9.2342.19200300.100.1.1 etc.). Check whether these lines match the attributes your IdP actually sends.id when the assertion contains one, so the auto-detection of id only applies to assertions without a NameID. Add an id=... line to the Attribute mapping to use another attribute.email and takes precedence over the auto-detected e-mail attributes (e.g. mail). Add an email=... line to the Attribute mapping to use a specific attribute instead.id
urn:oid:1.3.6.1.1.1.1.0 (LDAP uidNumber)http://schemas.microsoft.com/identity/claims/objectidentifier (Entra ID)uidNumberobjectGUIDobjectguidsubjectiduserididurn:oid:0.9.2342.19200300.100.1.3 (LDAP mail)http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress (AD FS)http://schemas.microsoft.com/identity/claims/email (Entra ID)mailemailemailAddressEmailAddressemail_addressusername
urn:oid:0.9.2342.19200300.100.1.1 (LDAP uid)http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn (AD FS UPN)http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name (AD FS name)http://schemas.microsoft.com/identity/claims/preferred_username (Entra ID)http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname (AD FS / Windows)http://schemas.goauthentik.io/2021/02/saml/username (Authentik)sAMAccountNamesamaccountnameuidusernameuserNameUserNamepreferred_usernameBecause the UPN comes first, an IdP that sends both UPN and a plain user name (e.g. AD FS, Authentik) results in usernames like john@example.com. To use the plain name instead, add a mapping such as username=http://schemas.goauthentik.io/2021/02/saml/username.
If no username is found, it is generated from the e-mail address when SAML manages user profiles is enabled. Otherwise the user has to choose a username on the registration form.
firstname
urn:oid:2.5.4.42 (LDAP givenName)http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname (AD FS)givenNamegivennameGivenNamefirstnamefirstNamefirst_namelastname
urn:oid:2.5.4.4 (LDAP sn)http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname (AD FS)snsurnameSurnamelastnamelastNamelast_nameWorks with the standard SAML 2.0 SP profile. Use the IdP metadata import.
http://schemas.xmlsoap.org/… claim URLs, so either form works.AD FS often rejects unsigned outgoing logout messages. If you use Single Logout, enable Sign LogoutRequest and Sign LogoutResponse under Security and configure the HumHub SP keypair under HumHub identity (Service Provider).
Works out of the box:
Standard claims are auto-detected — no attribute-mapping changes needed.
Older versions of this manual recommended enabling Single Role Attribute on Keycloak's
role_listmapper. That workaround is no longer required.
Works via the standard SP metadata import. In Okta, create the application via Applications → Create App Integration → SAML 2.0 and either upload HumHub's SP metadata or paste in the individual values from the HumHub Metadata tab.
Works via the Enterprise Applications → New application → Create your own application → Non-gallery flow. Upload HumHub's SP metadata under Single sign-on → SAML → Upload metadata file. The HumHub auto-detection recognises Azure-AD's http://schemas.microsoft.com/identity/claims/* claim names out of the box.
Any SAML 2.0–compliant IdP should work via the standard metadata exchange. If you hit an integration issue, please open one at humhub/saml-sso-issues — include the IdP name/version and any error messages from the HumHub log (Administration → Information → Logging).
By default SAML acts as a pure authentication client — new users that sign in through SAML are created the same way as form-based self-registrations. Their profile fields stay editable and admin approval follows the global Require approval before login setting.
The Users section in the SAML settings offers two checkboxes to change this:
The flag is only applied to new users created via SAML — existing users keep their original provisioning state.
Several settings under Security — signed AuthnRequest, signed LogoutRequest / LogoutResponse, encrypted NameID / Assertion — require a HumHub-side X.509 keypair so the SP can sign outgoing messages and decrypt incoming encrypted content. Create a self-signed one:
openssl req -newkey rsa:3072 -new -x509 -days 3652 -nodes -out saml.crt -keyout saml.pem
Paste the contents into the HumHub identity (Service Provider) section of the SAML settings:
saml.pem → HumHub private keysaml.crt → HumHub certificate (X.509)After saving, the IdP needs to learn the new SP certificate too — re-download the SP metadata XML from the HumHub Metadata tab and re-import it on the IdP side.
SAML defines two HTTP bindings for transporting messages between SP and IdP. HumHub's current support:
| Direction | What HumHub supports |
|---|---|
| SP → IdP (AuthnRequest, login) | HTTP-Redirect only |
| IdP → SP (Response with Assertion, ACS) | HTTP-POST (standard) |
| SP → IdP (LogoutRequest) | HTTP-Redirect only |
| IdP → SP (LogoutRequest / LogoutResponse, SLO callback) | HTTP-Redirect and HTTP-POST (both accepted) |
Known limitation: the bundled onelogin/php-saml library does not support HTTP-POST for outgoing AuthnRequest or LogoutRequest. Most IdPs accept both — the limitation only matters when an IdP specifically requires HTTP-POST for these directions (rare, seen with some hardened enterprise ADFS setups and a few large-AuthnRequest signed-flow scenarios).
If you need HTTP-POST for outgoing requests, please open an issue at humhub/saml-sso-issues describing the IdP you're integrating with — implementing it requires custom code outside the OneLogin library and we'll prioritise based on real demand.
The settings exposed in the admin form cover the common cases. For exotic deployments, the underlying OneLogin SAML library accepts many more options. Override anything in the SP / IdP / security sections via protected/config/common.php:
<?php
return [
'modules' => [
'saml-sso' => [
'advancedSettings' => [
'security' => [
// Example: relax destination validation if your IdP
// rewrites the ACS URL through a proxy.
'relaxDestinationValidation' => true,
],
'sp' => [
// ...
],
'idp' => [
// ...
],
],
],
],
];
Reference:
advancedSettings is merged on top of the values built from the admin form, so admin-form settings win unless the same key is set in advancedSettings.
openssl, dom, libxml, zlib. All ship with standard PHP builds on the major Linux distributions.X.509 handling uses the system OpenSSL library — no separate installation step required.