The following process provides steps to configure SAML 2.0 with Okta for Mattermost.
Before you begin, you need generate encryption certificates for encrypting the SAML connection.
You can use the Bash script from the
mattermost/docsrepository on GitHub, or any other suitable method.
Save the two files that are generated. They are the private key and the public key. In the System Console, they are referred to as the Service Provider Private Key and the Service Provider Public Certificate respectively.
Sign in to Okta as an administrator.
Switch to the Classic UI, using the drop-down in the upper left.
Go to Admin Dashboard > Applications > Add Application.
Select Create New App, then choose SAML 2.0 as the Sign on method.
Enter General Settings for the application, including App name and App logo (optional). It’s recommended to display the application icon to users, including in the Okta Mobile app. If you’d like to use a Mattermost logo for the application, you can download one from our page.
Enter SAML Settings, including:
Single sign on URL:
https://<your-mattermost-url>should typically match the Mattermost Site URL.
Audience URI: For instance,
Name ID format:
To set up encryption for your SAML connection, select Show Advanced Settings.
Set Assertion Encryption as Encrypted, then upload the Service Provider Public Certificate you generated earlier to the Encryption Certificate field.
Enter attribute statements used to map attributes between Okta and Mattermost. For more information on which attributes are configurable, see our documentation on SAML configuration settings. Email and username attributes are required. For SAML with Okta, an ID attribute is also required, and that ID must be mapped to
Select Next. Then, set Okta support parameters for the application. Recommended settings:
I’m an Okta customer adding an internal app
This is an internal app that we have created
In the Mattermost System Console, go to Authentication > SAML 2.0, then set Override SAML bind data with AD/LDAP information to false if currently set to true. You can re-enable this configuration setting later when once setup is complete.
On the next screen, select the Sign On tab, then select View Setup Instructions.
Select the Identity Provider metadata link, then copy the link from the browser URL field. This will be used during the SAML configuration steps in the next section.
Take note of Identity Provider Single Sign-On URL (also known as SAML SSO URL), and the Identity Provider Issuer, as both may be needed to configure SAML for Mattermost.
Download the X.509 Certificate file and save it. You may need to upload it to Mattermost in a later step.
Start the Mattermost server and sign into Mattermost as a System Admin. Go to System Console > Authentication > SAML 2.0, then paste the copied Identity Provider Metadata URL in the Identity Provider Metadata URL field and select Get SAML Metadata from IdP.
This populates the SAML SSO URL and the Identity Provider Issuer URL fields automatically. The Identity Provider Public Certificate is also downloaded from the server and set locally.
- Alternatively you can enter the following fields manually:
SAML SSO URL:
Identity Provider Single Sign-On URLfrom Okta, specified earlier.
Identity Provider Issuer URL:
Identity Provider Issuerfrom Okta, specified earlier.
Identity Provider Public Certificate: X.509 Public Certificate file you downloaded from Okta earlier.
Configure Mattermost to verify the signature. The Service Provider Login URL is the
Single sign on URLyou specified in Okta earlier.
Enable encryption based on the parameters provided earlier.
Configure Mattermost to sign SAML requests using the Service Provider Private Key.
- Set attributes for the SAML Assertions used to update user information in Mattermost.
Attributes for Email, Username, and Id are required and should match the values you entered in Okta earlier.
(Optional) Customize the login button text.
(Optional) If you configured
First NameAttribute and
Last NameAttribute, go to System Console > Site Configuration > Users and Teams, then set Teammate Name Display to Show first and last name. This is recommended for a better user experience.
Once complete, and to confirm SAML SSO is successfully enabled, switch your System Administrator account from email to SAML-based authentication from your avatar via Profile > Security > Sign-in Method > Switch to SAML SSO, then sign in with your SAML credentials to complete the switch.
We also recommend that you post an announcement for your users to explain how the migration will work.
You may also configure SAML for Okta by editing the
config.json file to enable SAML based on SAML configuration settings. You must restart the Mattermost server for the changes to take effect.
In addition to configuring SAML sign-in, you can optionally configure synchronizing SAML accounts with AD/LDAP. When configured:
Mattermost queries AD/LDAP for relevant account information and updates SAML accounts based on changes to attributes (first name, last name, and nickname)
Accounts disabled in AD/LDAP are made inactive in Mattermost, and their active sessions are revoked once Mattermost synchronizes attributes.
To configure SAML synchronization with AD/LDAP:
Go to System Console > Authentication > SAML 2.0, then set Enable Synchronizing SAML Accounts With AD/LDAP to true.
Go to System Console > Authentication > AD/LDAP, then set Enable Synchronization with AD/LDAP to true.
To ignore guest users when sychronizing, go to System Console > Authentication > SAML 2.0, then set Ignore Guest Users when Synchronizing with AD/LDAP to true.
Set the rest of the AD/LDAP settings based on configuration settings documentation to connect Mattermost with your AD/LDAP server.
If you don’t want to enable AD/LDAP sign-in, go to System Console > Authentication > AD/LDAP, then set Enable sign-in with AD/LDAP to false.
To specify how often Mattermost synchronizes SAML user accounts with AD/LDAP, go to System Console > Authentication > AD/LDAP, then set a Synchronization Interval in minutes. The default setting is 60 minutes. If you want to synchronize immediately after disabling an account, select AD/LDAP Synchronize Now.
To confirm that Mattermost can successfully connect to your AD/LDAP server, go to System Console > Authentication > AD/LDAP, then select AD/LDAP Test.
Once the synchronization with AD/LDAP is enabled, user attributes are synchronized with AD/LDAP based on their email address. If a user with a given email address doesn’t have an AD/LDAP account, they will be deactivated in Mattermost on the next AD/LDAP sync.
To re-activate the account:
Add the user to your AD/LDAP server.
Purge all caches in Mattermost by going to System Console > Environment > Web Server, then select Purge All Caches.
Run AD/LDAP synchronization by going to System Console > Authentication > AD/LDAP, then select AD/LDAP Synchronize Now.
Purge all caches again in Mattermost by going to System Console > Environment > Web Server, then select Purge All Caches again. This re-activates the account in Mattermost.
If a user is deactivated from AD/LDAP, they will be deactivated in Mattermost on the next sync. They will be shown as “Inactive” in the System Console users list, all of their sessions will expire and they won’t be able to log back in to Mattermost.
If a user is deactivated from SAML, their session won’t expire until they’re deactivated from AD/LDAP. However, they won’t be able to log back in to Mattermost.
SAML synchronization with AD/LDAP is designed to pull user attributes such as first name and last name from your AD/LDAP, not to control authentication.
In particular, the user filter cannot be used to control who can log in to Mattermost, this should be controlled by your SAML service provider’s group permissions.
See technical description of SAML synchronization with AD/LDAP for more details.
Alternatively, you can choose to override SAML bind data with AD/LDAP information. For more information on binding a user with the SAML ID Attribute, please refer to this documentation.
This process overrides SAML email address with AD/LDAP email address data or SAML Id Attribute with AD/LDAP Id Attribute if configured. We recommend using this configuration with the SAML ID Attribute to help ensure new users are not created when the email address changes for a user.
To ensure existing user accounts do not get disabled in this process, ensure the SAML IDs match the LDAP IDs by exporting data from both systems and comparing the ID data. Mapping ID Attributes for both AD/LDAP and SAML within Mattermost to fields that hold the same data will ensure the IDs match as well.
Set the SAML
Id Attributeby going to System Console > Authentication > SAML 2.0 > Id Attribute.
Set System Console > Authentication > SAML 2.0 > Override SAML bind data with AD/LDAP information to true.
Set System Console > Authentication > SAML 2.0 > Enable Synchronizing SAML Accounts With AD/LDAP to true.
Run AD/LDAP sync by going to System Console > Authentication > AD/LDAP, then select AD/LDAP Synchronize Now.
Alternatively, you can use an
Id attribute instead of email to bind the user. We recommend choosing an ID that is unique and will not change over time.
Configuring with an
Id attribute allows you to reuse an email address for a new user without the old user’s information being exposed. For instance, if a user with an email address email@example.com was once an employee, a new employee named Joe Smith can use the same email. This configuration is also useful when a user’s name changes and their email needs to be updated.
This process was designed with backwards compatibility to email binding. Here is the process applied to new account creations and to accounts logging in after the configuration:
A user authenticated with SAML is bound to the SAML service user using the Id Attribute (as long as it has been configured) or bound by email using the email received from SAML.
When the user tries to login and the SAML server responds with a valid authentication, then the server uses the “Id” field of the SAML authentication to search the user.
If a user bound to that ID already exists, it logs in as that user.
If a user bound to that ID does not exist, it will search base on the email.
If a user bound to the email exists, it logs in with email and updates the autentication data to the ID, instead of the email.
If a user bound to the ID or email does not exist, it will create a new Mattermost account bound to the SAML account by ID and will allow the user to log in.
Existing accounts won’t update until they log in to the server.
Yes. IWA is supported on the browser, with support added to iOS and Android mobile apps in Q2/2019 (mobile apps v1.18 and later).
However, IWA is not supported on the Mattermost Desktop Apps due to a limitation in Electron. As a workaround you may create a browser desktop shortcut for quick access to Mattermost, just like a Desktop App.
OAuth 2.0 was primarily intended for delegated authorization, where an app is authorized to access resources, such as Google contact list. It doesn’t deal with authentication.
OpenID Connect is built on top of OAuth 2.0, which supports authentication and thus direct SSO.
SAML is like OpenID Connect, except typically used in enterprise settings. OpenID Connect is more common in consumer websites and web/mobile apps.