Connect Mattermost to Keycloak
Connect Mattermost to Keycloak with an edition-aware OIDC or SAML choice, account mapping, team permissions and separate mobile and token revocation checks.
Last updated
In short
- Current Entry offers SSO with material history and service limitations.
- Choose OIDC or SAML against the required lifecycle and group behavior.
- Existing accounts and mobile sessions need migration and revocation tests.
On this page (6)
Integrations · Part of Mattermost
Select the edition before promising SSO behavior
Mattermost’s current OIDC and SAML documentation lists support on Entry, Professional, Enterprise and Enterprise Advanced. It would therefore be inaccurate to say that every Keycloak SSO deployment necessarily requires a paid plan. It would also be inaccurate to treat free Entry as equivalent to an unrestricted supported production subscription.
The edition documentation describes Entry’s limitations, including a server-wide visible/searchable channel-history limit and omitted operational capabilities. Team Edition is a different offering. Record the actual binary, licence, release and required history, support and availability features before choosing the deployment.
This is a reference integration and acceptance procedure, not a Pilae lab result. The upstream SAML Keycloak guide names its own tested Keycloak version; that upstream statement does not establish compatibility for every newer release or your environment.
Choose OIDC or SAML against the lifecycle requirement
| Requirement | OIDC design question | SAML design question |
|---|---|---|
| Browser sign-in | Discovery, client and callback | Metadata, entity ID and assertion endpoint |
| Stable identity | Subject and supported account mapping | Stable mapped identifier and assertion attributes |
| Profile updates | Supported claim synchronization | Supported attribute synchronization |
| Directory-managed membership | Verify actual supported mechanism | Verify LDAP/SAML combination and edition |
| Certificate/key rotation | OIDC signing keys and client credential | Signing/encryption certificates and metadata |
| Existing accounts | Supported authentication-method migration | Supported authentication-method migration |
The OIDC guide specifically discusses limits around LDAP-derived teams, channels and groups for OIDC users, while newer releases add some claim-based attribute capabilities. Do not equate profile claims with complete group lifecycle synchronization. Choose the protocol using the behavior you need, not only the easiest login demo.
Prepare a dedicated client and safe account mapping
For OIDC, create a dedicated Keycloak client and use the callback documented by Mattermost, including the /signup/openid/complete path under the actual HTTPS service URL. Configure the expected discovery endpoint, client ID and protected secret. Restrict who may authenticate through the client.
For SAML, use the current upstream metadata and certificate procedure for the selected releases. Signing and encryption algorithms can differ for special builds, including FIPS configurations; follow the applicable documentation rather than copying legacy settings. Keep private keys under the secret-management process and rehearse certificate replacement.
Inventory existing Mattermost users before enabling automatic account creation. Record their current authentication method, internal account identity, email and team membership. Use the supported account-migration process to preserve messages and ownership. A new account with the same display name is not a successful migration of the old one.
Test team and channel boundaries
Create synthetic accounts for a general employee, a restricted-team member, an administrator and an unassigned user. Use harmless messages and attachments with unique markers.
| Scenario | Expected result |
|---|---|
| Approved employee signs in | Reaches the intended existing or new account |
| Unassigned identity signs in | Cannot obtain unintended workspace access |
| General employee searches restricted marker | No private-channel content or attachment exposed |
| Restricted member opens approved channel | Correct read/post capability |
| Ordinary user accesses system administration | Denied |
| Email changes | Account history remains attached correctly |
| Guest identity enters | Only explicitly approved guest scope |
Check search, direct message links, file downloads and mobile clients. A private channel absent from the sidebar can still have another access path that deserves testing. Record how users join teams and channels and who can invite external people.
Measure offboarding across active clients
Disable the user in Keycloak while their browser and mobile app remain connected. Test fresh login, current session activity and token refresh. Then perform the required Mattermost-side deactivation or credential revocation and observe the result.
Bot accounts, personal access tokens, webhooks and integrations may have lifecycles independent of the human SSO session. Assign them owners and document which must be transferred, rotated or revoked when a person leaves. Do not claim immediate network-wide revocation based solely on the identity provider rejecting a new login.
If group synchronization is part of the design, remove the user from a source group and test effective team/channel membership after the documented synchronization interval. Include temporary synchronization failure and restoration so stale access is visible to operators.
Recover authentication without losing message history
Back up Mattermost’s database, files, configuration and required secret material, and preserve Keycloak’s relevant client state. Restore into an isolated environment and verify that accounts still own the correct messages and attachments. Avoid enabling duplicate integrations or notifications during recovery.
Keep a controlled recovery administrator and the prior authentication configuration while piloting SSO. If account mapping fails, restore the prior login route and inspect any newly created users before deleting them. Removing an account is not a safe generic way to undo an identity-linking error.
Recheck login, denied access, account continuity, mobile behavior and certificate/secret rotation after upgrades. Acceptance should state the exact edition and releases, the history and support limits accepted by the organization, and the measured offboarding behavior. That produces a usable messaging identity service rather than a protocol-only integration.
Sources and further reading
Use the linked documentation to confirm the version, edition and contract that apply to your project.
