Files
wekan/docs/Features/Login/SAML.md
T
Lauri Ojansivu 679a8b3499 Reject LDAP empty credentials, enforce directory groups and prevent SAML replay
Audit authentication boundaries following GHSA-m87f-f43w-hwmc. Guard both LDAP user-bind paths and the DDP/REST entry point, preserve service-account group lookup, compare CAS groups literally, and require single-use SAML request correlation. Add positive, negative, protocol and browser regressions with Problems summaries.

Thanks to kta1kri and xet7 !
2026-09-27 16:49:39 +03:00

6.0 KiB

How to enable it

WeKan has SP-initiated SAML 2.0 login, built on the actively-maintained, MIT-licensed @node-saml/node-saml library (it does all SAML protocol / XML-signature handling; WeKan only wires it into Meteor's accounts system - see the wekan-accounts-saml package under packages/wekan-accounts-saml/).

Enable it with these environment variables (see the commented example in docker-compose.yml):

Variable Meaning
SAML_ENABLED Set to true to show the "Sign In with SAML" button.
SAML_PROVIDER Short name for the identity provider; used in the ACS/callback URL.
SAML_ENTRYPOINT The identity provider's SSO redirect endpoint.
SAML_ISSUER This WeKan instance's SAML issuer / entity ID.
SAML_CERT The identity provider's signing certificate, used to verify the response signature.
SAML_IDPSLO_REDIRECTURL The identity provider's Single Logout redirect URL, if used.
SAML_PRIVATE_KEYFILE / SAML_PUBLIC_CERTFILE Paths under private/ to this instance's own key/cert, only needed if the IdP requires signed AuthnRequests.
SAML_IDENTIFIER_FORMAT NameID format requested from the IdP. Defaults to urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress.
SAML_LOCAL_PROFILE_MATCH_ATTRIBUTE Assertion attribute to use as the WeKan username instead of the NameID/email.
SAML_ATTRIBUTES Assertion attributes read for the local profile.

The client opens a popup at /_saml/authorize, which redirects to the identity provider (SAML_ENTRYPOINT); the IdP posts the signed assertion back to /_saml/validate (WeKan's Assertion Consumer Service URL - <WeKan URL>/_saml/validate/<SAML_PROVIDER>), which is registered as the service's callback URL with the IdP. This mirrors the existing CAS popup-based login flow (packages/wekan-accounts-cas).

Admin Panel overrides and logout

Site administrators can open Admin Panel / People / SAML at /admin/people/saml. The shared settings form shows environment variable names and the source of each effective value. Saved values override the environment; blank fields and the Default boolean choice restore environment/default values. Saving applies the configuration without a server restart. Disabling SAML removes its service configuration and prevents pending credentials from completing login.

The page lists the assertion consumer, logout callback and public metadata URLs. Register /_saml/config/<SAML_PROVIDER> as the metadata endpoint where supported. When SAML_IDPSLO_REDIRECTURL is configured, signing out a SAML user first obtains a logout request, ends the local session, then navigates to the identity provider. The callback accepts validated logout responses; IdP-initiated logout requests are not supported. Protocol validation uses the existing MIT-licensed node-saml library. Metadata contains no private keys.

SAML_MERGE_EXISTING_USERS defaults to false. Enabling it allows SAML identities to match existing non-SAML usernames, so use it only with a trusted, controlled identity mapping. Its Admin Panel override follows the same precedence rules.

Configuration and route tests and Chromium settings tests cover this integration. End-to-end interoperability with a live identity provider still requires testing.

Sandstorm has SAML login, and old WeKan that will be updated someday:

How SAML works:

Ruby on Rails OmniAuth, that has Shibboleth and SAML:

The SSO Wall of Shame:

SAML Issue

SAML settings commit

The maintained implementation is in packages/wekan-accounts-saml/; configuration is in server/saml.js and models/lib/samlConfig.js.

Gitea

Laravel

ruby-saml/omniauth/RoR: Sign in as anyone: Bypassing SAML SSO authentication with parser differentials

Integration tests

See local login protocol tests for example identities, actual request/response checks, failure cases and deployment limitations.

Request correlation and replay protection

SAML login must start from WeKan's sign-in button. Responses require a live InResponseTo request ID; unsolicited IdP-initiated assertions and replayed responses are rejected. Signed responses still undergo node-saml signature, time and audience checks. Authentication requests and replay protection are process-local, so clustered instances require sticky routing for the login handshake. See the authentication boundary audit.