Skip to content
Operate

SAML 2.0

Connect the engine to AD FS, PingFederate, Entra ID, Okta or any SAML 2.0 identity provider.

On this page

Use SAML when your identity team standardizes on it, as many AD FS and PingFederate shops do. The engine is the service provider (SP); sign-in always starts at the engine.

What the engine requires

  • A signed assertion, SHA-256 or stronger. Unsigned and SHA-1 signed assertions are refused, even inside a signed Response. Set ENGINE_SAML_REQUIRE_SIGNED_RESPONSE=true to also require the Response signature.
  • SP-initiated sign-in. The Response must answer the engine's AuthnRequest (InResponseTo). IdP-initiated sign-in (from an app portal tile) is refused; point the tile at /api/auth/sso/saml/start instead.
  • Destination and Audience set to the engine's ACS URL and entity ID, and a bearer SubjectConfirmationData with InResponseTo (the engine's request) and Recipient (the ACS URL), as every SP-initiated IdP sends.
  • Unencrypted assertions over https. Encrypted assertions are not supported.
  • One use. A replayed assertion is refused.

Steps

1. Get the engine's metadata

With ENGINE_PUBLIC_URL=https://engine.example.test, the SP metadata is at https://engine.example.test/api/auth/sso/saml/metadata. It holds:

FieldValue
Entity IDhttps://engine.example.test/api/auth/sso/saml/metadata
ACS URLhttps://engine.example.test/api/auth/sso/saml/acs
BindingHTTP-POST

2. Create the relying party at the IdP

Import the metadata, or enter the entity ID and ACS URL by hand. Send:

  • the NameID as the email address (or a persistent id, plus an email attribute);
  • the groups as an attribute. Without ENGINE_SAML_GROUPS_ATTRIBUTE the engine reads the first of groups, the Microsoft groups claim, the AD FS claims/Group claim, memberOf and group that is present; it never merges them and never reads a role claim as groups. To map Entra app roles instead, set ENGINE_SAML_GROUPS_ATTRIBUTE to the role claim.

On AD FS, add a claim rule Send LDAP Attributes as Claims: E-Mail-Addresses to Name ID and E-Mail Address, and Token-Groups - Unqualified Names to Group.

3. Configure the engine

bash
ENGINE_SAML_IDP_ENTITY_ID=http://adfs.example.test/adfs/services/trust
ENGINE_SAML_IDP_SSO_URL=https://adfs.example.test/adfs/ls/
ENGINE_SAML_IDP_CERT="-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----"
ENGINE_SAML_LABEL="Active Directory"
ENGINE_SAML_GROUP_ROLES="MedHook Admins=admin;MedHook Operators=operator"

ENGINE_SAML_IDP_CERT is the IdP's token-signing certificate, PEM or base64. Put two during a certificate rollover; both are accepted until you remove the old one.

4. MFA

The engine treats these authentication contexts as multi-factor: Entra's multipleauthn, AD FS's phone factor, SAML's mobile two-factor classes and the REFEDS MFA profile. A smart card or token class alone does not count. Set ENGINE_SAML_REQUIRE_MFA=true to refuse anything else.

5. Test

Sign in from /sign-in with Continue with Active Directory. A refused Response is in the audit log as auth.signin_failed with the reason, such as invalid_signature, audience, destination, expired, in_response_to or replay.

Reference