SAML authentication can be used to log in to the Mitrefinch TMS web application. As the authentication requires a HTTP redirect to the Identity Provider, and another back to the TMS web application, it is only applicable in systems where both the TMS web application and the identity provider can be accessed from the client browser.
Therefore other Mitrefinch applications such as TMS for Mobile or WinTMS are unable to use SAML to authenticate users, and will instead use normal TMS authentication. SAML may be used with mobile devices or the TMS Outlook Add-in by requesting the full desktop version of the web application.
To turn on SAML authentication, find the AdfsType key in the web.config file, and change it from “None” to “SAML”. If the key isn’t present in your file, pick up the updated web.config from the release package and merge the new entries into your file.
To allow SAML authentication, changes need to be made to the web.config file. Before making the changes, ensure you download and install URL Rewrite from the following link:
https://www.iis.net/downloads/microsoft/url-rewrite
Installing this extension will allow the following changes to web.config to work.
Once the extension has been installed, locate your web.config file and add the following lines into the <system.webServer> section. There may be several locations in your web.config file that has <system.webServer> - the correct section is around line 549, and is a section that is not nestled into another section (e.g. on line 276 the <system.webServer> is nestled into the <location path> section). The lines to add are as follows:
<system.webServer>
<rewrite>
<outboundRules>
<rule name="AddSameSiteCookieFlag">
<match serverVariable="RESPONSE_Set-Cookie" pattern="((.*)(__SessionId)(=.*))(SameSite=Lax)" />
<action type="Rewrite" value="{R:1};SameSite=None" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
As of version 8.36.0.0, changes have been made to the standard web.config file (this is normal found in the "WebConfig" sub-folder of the TMS 8 website folder) to support changes in how web browsers handle cookies and follow recommended security practice. The change was made to limit cross-site attacks in TMS 8. A new section of code has been introduced to the file:
<!-- sameSite and cookieSameSite can be one of [None|Lax|Strict]. For SAML authentication, the sessionState needs to be cookieSameSite="None" and the site must be https
The httpCookies and forms setting can also specify requireSSL="true" to force cookies to be sent as https on https enabled sites, but will cause logins to fail on http only sites-->
<httpCookies httpOnlyCookies="true" sameSite="Lax" requireSSL="true" />
<sessionState cookieName="__SessionId" mode="StateServer" cookieSameSite="Lax" />
<authentication mode="Forms">
<forms name="__Auth" loginUrl="tms/login" timeout="20" defaultUrl="dashboard/home/" cookieSameSite="Lax" />
</authentication>As mentioned in the code snippet, this change may affect users who use SAML authentication in TMS 8.
<?xml version="1.0"?>
<SAMLConfiguration xmlns="urn:componentspace:SAML:2.0:configuration">
<ServiceProvider Name="https://tms.myserver.com/"
AssertionConsumerServiceUrl="https://myserver.com/tms8/TMS/Saml/Index"
LocalCertificateFile="adfs-sign.pfx"
LocalCertificatePassword="pass" />
<PartnerIdentityProviders>
<PartnerIdentityProvider
Name="https://adfs.myserver.com/adfs/services/trust"
Description="ADFS"
SignAuthnRequest="true"
SignLogoutRequest="true"
WantSAMLResponseSigned="false"
WantAssertionSigned="true"
WantAssertionEncrypted="true"
WantLogoutResponseSigned="true"
DigestMethod="http://www.w3.org/2000/09/xmldsig#sha1"
SignatureMethod="http://www.w3.org/2000/09/xmldsig#rsa-sha1"
SingleSignOnServiceBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
SingleSignOnServiceUrl="https://adfs.myserver.com/adfs/ls/"
PartnerCertificateFile="adfs_token_signing.cer"
SingleLogoutServiceBinding = "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
SingleLogoutServiceUrl = "https://adfs.myserver.com/adfs/ls/"/>
</PartnerIdentityProviders>
</SAMLConfiguration>
The ServiceProvider part of the file describes the TMS system to your Identity Provider. This is always required, whether you are configuring manually or using metadata.
The name is the identifying string for your TMS service on your Identity Provider – normally you will set this to match your main TMS URL. The AssertionConsumerServiceUrl is the path to TMS/Saml/Index in your TMS web directory, and the LocalCertificateFile is the path of the certificate you wish to use. If only a name is specified (as above), it will look for the file in the TMS web directory.
When configuring the Relying Party Trust on your Identity Provider, the details must match as follows:
Must be added as a Relying party identifier
Must be used as the URL for a POST SAML Assertion Consumer Endpoint, and (where single log-out is required) for POST and Redirect SAML Logout Endpoints.
The corresponding public key (*.cer file) should be set as the Encryption certificate, and Signature verification certificate.
Note also that the secure hash algorithm of the relying party trust must be set to SHA-1.
The PartnerIdentityProvider section defines the Identity Provider that you are connecting to. If using metadata to configure your system, this will be imported automatically.
If setting up manually, the values will normally be identical to those above, where adfs.myserver.com is the path to your ADFS server, and the Name is set to the FederationServiceIdentifier in ADFS.
The certificate used (adfs_token_signing.cer above) is the public key of the Token-signing certificate exported from ADFS and copied to your TMS web server.
There are several other options in the web.config file that can be used to customise the operation of SAML authentication in TMS. The full list of options are as follows:
Whether to use SAML authentication or not. Valid options are None and SAML.
The URL of the Identity Provider’s metadata file. Leave empty if you’re not importing metadata.
If true, then a TMS login is available as a fall-back option – either provided as an option when a SAML login doesn’t match a TMS user, or by browsing to TMS/Login/Index?noadfs=true.
This is useful in cases where not every user has an account on the Identity Provider, or connectivity with the Identity Provider is known to be a problem. But where security is the primary concern, this should be set to false to force users to login through SAML.
The field in TMS used to match employees against the token supplied by SAML authentication. By default TMSTMS.USERNAME, however you may want to change this on systems where Windows Authentication is also enabled.
The field in TMS used to match supervisors against the token supplied by SAML authentication. By default USERS.WINUSER, although again this may be changed.
When to display a logout prompt, informing the user that they have logged out and should close their browser to continue. On systems where Single Log-out is configured and working correctly, this should not be necessary, however when Single Log-out is not available it gives an alternative means of forcing users to close their browser, ending their session with the Identity Provider.
The options are:
None Never display the logout prompt. Use when Single Log-out is working correctly
Once Display the logout prompt once. When the user browses to another URL it will take them to the login screen. If they were logged in using SAML this will automatically log them in again.
Always Once logged out, always display the logout prompt until the browser window is closed. If they attempt to browse to another TMS URL, they will not be logged in and will be shown the logout prompt again.
OnceAfterSLO Display the logout prompt once, after making the Single Log-out request. If the request has worked, then when they next navigate to a TMS URL they will be prompted to login.
To enable logging, if not enabled for the whole of the TMS application, uncomment the web.config section labelled Enable this logger to turn on debugging for ADFS authentication only. This will cause log entries to be written into tms.log every time a SAML login or logout is attempted.
This is helpful in diagnosing connection faults during initial setup, and also to show the tokens that have been received when trying to match TMS users to SAML login requests.