Mattermost SAML SSO with Microsoft AD FS

How to connect a self-hosted Mattermost server to AD FS as its SAML identity provider, with the trust, claim rules, certificates and desktop login points to verify before rollout.

On this page

How Mattermost signs users in through AD FS over SAML

If your organization already runs Active Directory Federation Services and wants staff to sign in to self-hosted Mattermost with their existing credentials, the supported method is SAML 2.0 with AD FS as the identity provider, configured in the Mattermost System Console. Mattermost acts as the service provider: when a user starts sign-in, the browser is redirected to AD FS, AD FS authenticates the user against your directory and returns a signed SAML assertion, and Mattermost creates or matches the account from the attributes in that assertion. The AD FS side of this exchange is a relying party trust that you define for the Mattermost server, with the assertion consumer URL, the claim rules that send email and username, and the signing and encryption certificates that both sides must trust.

This integration covers sign-in and first-time account creation. It does not, on its own, keep profile attributes current after a user changes name or department, and it does not deactivate a user who leaves the organization. A disabled directory account stops new sign-ins at AD FS, but the Mattermost account remains active until it is deactivated some other way. Closing that gap is a separate decision, covered in the sibling topic on combining Mattermost SAML with AD/LDAP sync, and it should be planned before rollout rather than discovered during an access review.

Before you build the relying party trust, check each setting against the Mattermost SAML single sign-on documentation, since field names, attribute requirements and certificate handling are defined there and can change between server versions. Confirm which AD FS version your environment runs, which certificates your security team will issue and rotate for signing and encryption, and whether the desktop apps will need the forms-based login path described later in this topic. Plan a test tenant or staging server first, so that certificate expiry dates and claim mappings are verified before production users depend on them.

What you need in place before configuring AD FS for Mattermost

Five items need to be settled before anyone touches the AD FS console or the Mattermost System Console. Each one fixes a value the other steps depend on, so confirming them first avoids reworking the relying party trust later.

Mattermost plan with SAML

SAML is a paid capability in Mattermost. The pricing page lists SSO (SAML, OIDC, OAuth) from the Professional plan upward, so confirm your subscription level before planning the build. Check that the server you run is the edition and tier your contract covers, and ask your Mattermost account contact to confirm the SAML feature is enabled on your license. Mattermost does not publish prices, so the figure comes from your quote.

Mattermost pricing

Public HTTPS site URL

The Mattermost site URL becomes the Assertion Consumer Service address and the audience that AD FS signs against, so it must be stable before you create the trust. Confirm the exact public hostname, the TLS certificate that serves it, and that AD FS can reach it over HTTPS. Changing the hostname later means updating the relying party identifiers and the Mattermost SAML settings together.

Working AD FS farm and federation name

Record the AD FS version your farm runs, the federation service name clients use, and whether the farm sits behind a load balancer. Confirm the federation metadata URL responds from the network where users sign in. The federation service name and metadata address are what Mattermost needs to trust the identity provider, so write them down before the build starts.

Directory and group structure

Decide which Active Directory OU or security group supplies Mattermost users, and who is excluded, such as service accounts and disabled users. Confirm that every user who needs Mattermost has a mailbox or UPN, a username attribute, and a stable user identifier. Group design also affects later admin and guest role mapping, so check how those groups are named and nested before you issue claim rules.

Signing and encryption certificate ownership

Name the team that owns the token-signing certificate on AD FS, the service provider encryption certificate used for encrypted assertions, and the renewal process for both. Confirm expiry dates, who receives renewal alerts, and where the private key is stored. An expired certificate stops sign-in for every user at once, so ownership and renewal need to be recorded before go-live.

Where the email and username claims are issued in a SAML login

The login starts in the user's browser when Mattermost redirects it to AD FS as the identity provider. AD FS checks the user against the directory behind it, then applies its claim rules to build the email and username attributes and returns a signed and encrypted SAML response through the browser. Check the claim rules and the encryption certificate on the AD FS side first, because Mattermost only reads the attributes it receives and cannot correct them.

Sequence of a SAML sign-in, with the AD FS claim step and the trust boundary between networks.

The configuration sequence from relying party trust to first login

This sequence takes AD FS from a blank relying party trust to a verified Mattermost sign-in, with each step confirmed before the next begins. The result is a SAML identity provider that sends the attributes Mattermost needs to create and match accounts.

  1. Confirm the Mattermost SAML endpoints and audience

    Before touching AD FS, record the exact Assertion Consumer Service URL, the entity or audience value and the metadata location from your Mattermost SAML documentation, using the current version of the SAML single sign-on guide. Confirm these against your Mattermost site URL, because a mismatch in scheme, host or path is the most common reason the trust fails later. Check that your site URL resolves over HTTPS with a valid certificate from a browser on the AD FS server. Done means you have a written list of the three values and each one was checked against the live site URL.

  2. Create the relying party trust in AD FS

    On the AD FS management console, add a relying party trust using the option that takes data manually, not a federation metadata import unless your Mattermost version documents that path. Enter the display name, select the AD FS profile that matches your AD FS version, and skip optional token encryption settings until the first login works. Confirm the menu names and wizard pages against the AD FS version in use, since they vary between Windows Server releases. Done means the trust appears in the relying party list with the name you chose.

  3. Set the relying party identifier and endpoints

    Add the relying party identifier that matches the audience value recorded in the first step, and configure the SAML 2.0 Web SSO endpoint to the Assertion Consumer Service URL. Use the POST binding if your Mattermost documentation specifies it. A single character difference in the identifier produces an audience restriction error at login, so copy the value rather than retyping it. Done means the trust properties show the identifier and endpoint exactly as documented, and the identifier matches the audience Mattermost expects.

  4. Write the claim issuance rules for email and username

    Create issuance transform rules that send the directory attributes Mattermost needs as SAML claims. At minimum this is the email address, and a username attribute that Mattermost will use for account naming. If you use a stable ID attribute, add it as a separate claim and choose a value that does not change when a person is renamed or moved. Confirm the claim type URIs and attribute names in the current Mattermost SAML documentation, because Mattermost matches on these names exactly. Done means the claim rule list shows each required claim, and the AD FS claims viewer on a test user returns non-empty values.

  5. Attach the signing and encryption certificates

    Confirm the token-signing certificate that AD FS uses and export its public certificate in the format Mattermost accepts. If you plan to encrypt assertions, obtain the encryption certificate and assign it to the relying party trust, then record its thumbprint and expiry date. Keep a note of when each certificate expires, since an expired signing certificate stops all SAML logins without a clear error. Done means you hold the public certificate files, the trust shows the correct signing certificate, and the expiry dates are recorded in your renewal calendar.

  6. Enter the identity provider settings in the System Console

    In the Mattermost System Console, open the SAML single sign-on settings and enter the identity provider metadata URL or the metadata values, along with the certificate and attribute mappings for email, username and ID. Make the identity provider settings and attribute names match the claim rules exactly. Save the configuration and confirm the metadata URL resolves over HTTPS from the Mattermost server, since a server that cannot reach AD FS will fail silently at login. Done means the settings save without errors and the metadata URL returns the AD FS federation metadata document.

  7. Test with a pilot account and verify the new user record

    Sign in with a single pilot account through a private browser session, and then check the Mattermost user list in the System Console. Confirm that the account was created or matched with the expected email address, username and authentication method, and that the user can reach a channel. Repeat the test with an account that already exists under email login to see how Mattermost handles the match. Record any error from the AD FS audit log or the Mattermost server log before widening access. Done means one pilot login creates the expected account and a second test is documented.

Which AD FS claims map to which Mattermost user fields

This table compares each Mattermost user field with the AD FS claim that should populate it and the failure that follows if the mapping is wrong. Read it as a checklist for the claim rules you write in the relying party trust, then confirm every claim type URI and attribute name against the live Mattermost SAML settings.

Mattermost fieldAD FS claim sourceWhat breaks if it is wrong
Email (primary login identifier)Email address attribute from Active Directory, sent as the email claimUsers cannot match an existing account, so first logins create duplicate accounts or fail to sign in
UsernameAccount name attribute, mapped to the username claim your Mattermost settings expectUsernames become opaque or collide, and mentions and profile links break
First nameGiven name attribute, sent as the first name claimProfiles show blank or wrong names in channels and member lists
Last nameSurname attribute, sent as the last name claimProfiles show incomplete names and search results are harder to match
Stable ID attributeAn immutable identifier such as the AD object GUID, sent as the ID claimA change in the email or username attribute can orphan the account from its message history
Admin role (sibling topic)A dedicated role claim with the value Mattermost expects, set only for approved administratorsAdmins are not granted rights, or non-admins gain system console access
Guest role (sibling topic)A dedicated guest claim, scoped to external users onlyInternal staff are restricted, or guest demotion is attempted, which Mattermost does not allow in one direction

How web, desktop and mobile clients sign in differently

Browser users are the most direct case. When someone opens the Mattermost web app and chooses the SAML option, Mattermost redirects the browser to the AD FS sign-in page. The user authenticates there, AD FS posts a signed SAML response back to the Mattermost assertion consumer service, and Mattermost creates or matches the account from the claims it receives. The browser flow depends on the relying party trust, the claim rules for email and username, and the certificates that AD FS and Mattermost exchange.

  • Redirect path: The browser leaves Mattermost, authenticates at AD FS, and returns to the Mattermost site URL.
  • Claim dependencies: Email and username claims must arrive in the expected form, or the account match fails.
  • Session behavior: Confirm how long AD FS sessions last and whether Mattermost sessions expire on the same schedule.
  • Browser support: Test the browsers your organization allows, including any managed browser policies that block redirects.
  • Proxy and TLS: Confirm that the public Mattermost URL and the AD FS endpoints both use certificates trusted by the test devices.

Confirm the current browser behavior against the Mattermost SAML single sign-on documentation before the pilot, and record the result for each browser your users run.

Security settings to lock down in the AD FS and Mattermost integration

A SAML trust gives Mattermost sign-in decisions that rest on AD FS configuration, so the controls below belong to the AD FS team as much as the Mattermost team. Each one narrows who can sign in, what the assertion can be trusted for, and how the connection stays protected over time.

Require signed SAML responses

Configure the relying party trust so AD FS signs the SAML response and assertion, and confirm that Mattermost validates the signature against the token-signing certificate you published. Without that check, a forged or altered assertion could be accepted as a valid login. After setup, test with a known account and confirm that a response with a changed signature is rejected. Check the signing certificate's expiry date and record who renews it.

Mattermost SAML docs

Encrypt assertions with a managed certificate

Encrypted assertions keep user names, email addresses and group claims unreadable to anyone who captures the browser redirect. Use a dedicated encryption certificate, store the private key only where the AD FS service needs it, and match the public certificate on the Mattermost side. Name one owner for renewal and agree the rotation schedule with the AD FS team before go-live, because an expired certificate stops all SAML sign-ins at once.

Restrict the trust to Mattermost

Create a relying party trust that only lists the Mattermost SAML endpoint and audience, and remove any default or test trusts that AD FS may have inherited from a template. Each trust is a path into the identity provider, so unused relying party trusts widen the attack surface for no benefit. Review the trust list during the go-live check and again after each Mattermost upgrade that changes the SAML endpoint.

Limit which AD FS groups receive claims

Issue claim rules only to members of a named AD FS or directory group that is allowed to use Mattermost, rather than to every authenticated user in the forest. Authorization rules then control who can authenticate, and the group membership becomes the audit point for access reviews. Ask the directory team to confirm the group owner, the approval path for new members, and how leavers are removed from the group.

Enforce HTTPS on the Mattermost site URL

The SAML sign-in redirect, the assertion consumer service and the Mattermost site URL must all use HTTPS, or session cookies and assertions travel unprotected between browsers and servers. Confirm that the site URL in the System Console matches the URL in the AD FS trust exactly, including the host name and scheme. A mismatch often produces sign-in loops or failures that teams work around by weakening the setting, so fix the URL rather than relaxing the check.

Keep AD FS MFA policy on the trust

Apply the multi-factor authentication policy in AD FS to the Mattermost relying party trust, so that every sign-in is challenged before AD FS issues an assertion. Mattermost's own MFA enforcement is a separate topic and does not replace this step for SAML users. Confirm which access policy applies to desktop and mobile clients, since a policy written for browser sign-in may not cover every client path your users rely on.

Why AD FS logins to Mattermost fail and how to fix them

This table pairs each common AD FS to Mattermost SAML failure with its likely cause and a check the team can run. Read it from the symptom column when a login breaks, then confirm the cause against the SAML response and the AD FS event log before changing settings. The main takeaway is that most failures trace back to a mismatch between the relying party trust and the Mattermost SAML settings, or to claim rules that send the wrong value.

SymptomLikely causeFix and check to run
Sign-in fails with an unknown or invalid audience or relying party errorThe relying party identifier in AD FS does not match the Mattermost SAML audience or entity IDCompare the relying party identifier in AD FS with the audience value in a decoded SAML response. Correct the trust so both values match exactly, including trailing slashes and scheme
AD FS shows the sign-in page, then returns an error or loops to the login pageThe SSO URL or sign-on endpoint in the Mattermost SAML settings does not match the endpoint registered on the relying party trustCheck the endpoint URLs in the Mattermost SAML configuration against the AD FS endpoint list. Look for http or https mismatches and confirm the public hostname resolves the same way for users
User is signed in by AD FS but Mattermost rejects the account with no emailThe claim rule sends an empty or wrong value for the email attributeOpen the SAML response in a trace tool and confirm the email claim has a value. Review the issuance transform rules in the relying party trust and map the LDAP email attribute to the email claim
Users land on a profile with a wrong or generated usernameThe username claim maps to a field that is empty, duplicated or not unique across usersConfirm the username claim source attribute for several test accounts. Choose an attribute that is unique and stable, and check the AD FS event log for rule processing messages
New user cannot log in because an existing account has the same username or emailA username or email collision with an account created by another sign-in method or an earlier importSearch Mattermost users for the conflicting value before testing. Resolve duplicates first, and confirm the matching attribute chosen in the claim rules is the one you intend to keep
Login fails with a signature or certificate error in the Mattermost logThe token-signing or encryption certificate on AD FS does not match the certificate in Mattermost, or the certificate has expiredCompare the certificate thumbprint in AD FS with the certificate configured in Mattermost. Check expiry dates in both places and plan replacement before the current certificate ends
Assertions are rejected as not yet valid or expiredClock skew between the AD FS server, the Mattermost server and the user's deviceConfirm all servers sync to the same trusted time source. Compare the NotBefore and NotOnOrAfter values in the SAML response with the server time at the moment of login
Desktop app shows the login page but never completes sign-inThe desktop client cannot complete the browser-based SAML flow, so the team must confirm forms-based login is configured for that pathTest the same account in a browser and in the desktop app. If only the desktop client fails, review the AD FS authentication settings for that client path and the server URL configured in the app
Users sign in but lose access after an AD FS changeThe trust, certificate or claim rules changed without a matching update in MattermostKeep a change log for the relying party trust and certificate. After any change, run a test login with a non-admin account and review the AD FS admin audit events

What teams ask before configuring AD FS SSO for Mattermost

Can our own team configure AD FS SSO for Mattermost without a partner?

Yes, if you have people who already run AD FS and a Mattermost administrator who can work in the System Console. The work combines three skill sets: AD FS administration (relying party trust, claim issuance rules, token signing and encryption certificates), Mattermost administration (SAML settings, login testing, account handling) and enough network and DNS knowledge to get the federation endpoints reachable from the Mattermost server and from users' browsers. Teams without an AD FS owner usually find the claim rules and the certificate handling the hardest parts. Ask whether your team has done a SAML relying party setup before and whether it has a test AD FS environment to practice in.

What makes the AD FS SSO effort larger or smaller?

The main drivers are the shape of your AD FS deployment, how many Mattermost clients need to sign in through it, and how certificates are issued and renewed. A single AD FS server with one relying party is a much smaller job than a farm with proxies, multiple Mattermost environments (production, staging, test) and desktop clients that need forms-based login. Certificate processes add effort when a central PKI team controls issuance and approvals take weeks. Whether AD/LDAP sync is also required matters too, because SAML on its own does not keep profiles current or remove leavers, so the sync design becomes part of the same project.

How long does an AD FS SSO project take?

The duration depends on the scope you agree in writing, not on the protocol alone. A defined scope covers which environments are included, how many relying party trusts are configured, which claim rules apply, whether desktop clients are in scope, how testing is done and who approves the certificates. Certificate approval and change windows on the AD FS side often set the pace more than the configuration does. Ask any provider to break the schedule into discovery, configuration, pilot and rollout, and to list which steps depend on your internal approvals.

What do we need to provide during the project?

Four roles are needed. AD FS administrators own the farm, the relying party trust, the claim rules and access to the federation metadata. A Mattermost administrator owns the System Console settings, the test accounts and the decision about how existing users map to SAML identities. A certificate owner approves and tracks the token encryption and signing certificates and their expiry dates. A pilot group of real users tests sign-in on web, mobile and desktop before everyone is moved. Name these people before work starts, because a missing approver is the most common reason a schedule slips.

Does SAML sign-in remove users who leave the organization?

No. SAML authenticates users at sign-in, but it does not deactivate a Mattermost account when someone leaves or is disabled in Active Directory. A departed employee whose Mattermost session is still valid can keep access until the session ends or the account is deactivated by another process. To close that gap, you need a separate deprovisioning method. The sibling topic on combining Mattermost SAML with AD/LDAP sync explains how enabling directory synchronization alongside SAML deactivates leavers and keeps profiles current. Plan that design before go-live rather than treating it as a later cleanup task.

What work is one-time, and what recurs after go-live?

The initial relying party trust, claim rules, certificates and System Console configuration are one-time work. Ongoing work includes renewing token signing and encryption certificates before they expire, updating the metadata exchange if endpoints or certificates change, retesting sign-in after AD FS updates, and reviewing claim rules when directory attributes change. Mattermost server upgrades also recur, and each upgrade should include a check that SAML sign-in still works, because the release schedule is monthly and some releases are Extended Support Releases. Ask any provider whether it covers these recurring tasks in a retainer or leaves them with your team.

What should we ask for in a written scope before starting?

Ask for a list of the AD FS farm and Mattermost environments in scope, the number of relying party trusts, the claim rules for email, username and any admin or guest attributes, the certificate process and owner, the test plan including desktop forms-based login, the rollout approach for existing accounts, and a statement on whether AD/LDAP sync is included. Also ask who performs each step, what evidence you receive at handover, and which items depend on your change windows. Once those points are written down, a quote can follow directly from the agreed scope.

How DeployOpen scopes and delivers Mattermost SAML SSO with AD FS

DeployOpen plans, implements, documents and supports Mattermost SAML SSO with Microsoft AD FS inside your own infrastructure, so your identity and security teams can review each trust, claim rule and certificate before users depend on them. The work is agreed as a fixed-scope engagement with written deliverables, and ongoing support is available as a retainer.

How we scope

  • We confirm your AD FS version, federation service name and the Mattermost server URL before any build work starts.
  • The written scope lists the relying party trust, claim rules for email and username, and certificate handling for your environment.
  • We agree in writing whether forms-based login for desktop apps, admin role claims and AD/LDAP sync are in or out of scope.

How we build

  • We configure the relying party trust and claim rules in AD FS, then map the same attributes in the Mattermost SAML settings.
  • We set up encryption certificates and metadata exchange in a staging environment that mirrors your production Mattermost URL.
  • We test sign-in from web, desktop and mobile clients, and document each failed attempt and the fix that resolved it.

How we hand over

  • You receive a configuration record covering trust settings, claim rules, certificate locations and renewal dates for your team.
  • We deliver a runbook for onboarding users, rotating certificates and troubleshooting failed assertions in your own environment.
  • Testing evidence, including sign-in results and any retest after fixes, is handed over so your security team can review it.

How we support

  • Ongoing support covers AD FS and Mattermost changes, including monthly server releases and Extended Support Release planning, as a retainer.
  • Certificate expiry and claim rule changes are reviewed on a schedule agreed in the retainer, so sign-in does not break unexpectedly.
  • Where your compliance team needs evidence of access controls, we prepare the configuration and test records. Audit reports come from your independent auditor.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.