Skip to content

SAML: support Microsoft Entra ID with configurable authentication-context and response-signature options - #27

Open
aconite33 wants to merge 3 commits into
cryptpad:mainfrom
aconite33:saml-entra-fixes
Open

SAML: support Microsoft Entra ID with configurable authentication-context and response-signature options#27
aconite33 wants to merge 3 commits into
cryptpad:mainfrom
aconite33:saml-entra-fixes

Conversation

@aconite33

Copy link
Copy Markdown

Summary

This change allows the SAML connector to work with Microsoft Entra ID, and with other identity providers that enforce multi-factor authentication or sign only the assertion, without weakening signature validation. It adds two optional per-provider settings, improves an error log, and documents the Entra ID setup.

Background

The node-saml v5 release tightened two defaults that a default Entra ID SAML application does not satisfy. First, node-saml requests the PasswordProtectedTransport authentication context with exact matching. Entra rejects the sign-in with AADSTS75011 when the user completes multi-factor or passwordless authentication, because the method no longer matches the requested context. Second, node-saml requires the SAML response to be signed. Entra signs the assertion but not the response wrapper by default, so validation fails with the Invalid document signature error even though the assertion is correctly signed. The connector had no way to adjust either behavior, so a default Entra ID application could not complete login.

Changes

  • Pass disableRequestedAuthnContext from the provider config to node-saml. When set to true, CryptPad stops requesting a specific authentication context and allows the identity provider to apply its own policy, including multi-factor and passwordless authentication.
  • Pass wantAuthnResponseSigned from the provider config to node-saml. When set to false, CryptPad accepts a signed assertion inside an unsigned response. The assertion signature stays required, because node-saml still defaults wantAssertionsSigned to true, so an unsigned assertion is never accepted.
  • Log the serialized error in the SAML callback error path. The previous code logged the raw Error object, which serialized to an empty object and hid the reason for a failed validation.
  • Document the SAML provider fields and add a Microsoft Entra ID section to the README.

Compatibility

Both new options default to node-saml's existing behavior when a provider does not set them, so current deployments are unaffected. Operators who can sign the response at the identity provider should leave wantAuthnResponseSigned unset to keep requiring a signed response.

Testing

Verified an end-to-end SAML login against Microsoft Entra ID: the sign-in completed with multi-factor authentication, the account was created, and the drive loaded. Setting the Entra Signing Option to sign the response and removing wantAuthnResponseSigned also kept login working with the response signature required.

…ck errors

Pass cfg.disableRequestedAuthnContext through to node-saml so identity
providers that enforce multi-factor authentication or passwordless sign-in
(for example, Entra ID) can opt out of the default requested authentication
context. The value defaults to node-saml's existing behavior, so current
deployments are unaffected unless they set it.

Log Util.serializeError(err) in ERROR_SAML_CALLBACK instead of the raw error
object. The raw object serialized to an empty object and hid the failure
reason.
Pass cfg.wantAuthnResponseSigned through to node-saml. In node-saml v5, this
option defaults to true, which rejects the assertion with an "Invalid document
signature" error when the response wrapper is unsigned. Identity providers such
as Entra ID sign only the assertion by default, so this option allows an
operator to accept assertion-only signing. The assertion signature stays
required, because wantAssertionsSigned still defaults to true, so this change
never accepts an unsigned assertion. The value defaults to node-saml's
behavior, so current deployments are unaffected unless they set it.
Describe the SAML provider fields, including the new disableRequestedAuthnContext
and wantAuthnResponseSigned options, and add a Microsoft Entra ID section. The
section covers the Entity ID and Reply URL to register, the signing certificate
format, and the two Entra defaults that need attention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant