From 5f04dc4f45b9657d46380499f92ae6e5c1bf5506 Mon Sep 17 00:00:00 2001
From: enahum <nahumhbl@gmail.com>
Date: Tue, 5 Jul 2016 15:49:00 -0400
Subject: SAML support (#3494)

* PLT-3073: Implement SAML/Okta Server side (EE) (#3422)

* PLT-3137 Support for SAML configuration

* PLT-3410 SAML Database Store

* PLT-3411 CLI to add Identity Provider Certificate and Service Provider Private Key

* PLT-3409 SAML Interface for EE

* PLT-3139 Handle SAML authentication server side

* Add localization messages

* PLT-3443 SAML Obtain SP metadata

* PLT-3142 Login & Switch to/from SAML

* Remove Certs for Database & Clean SAML Request

* Make required Username, FirstName and LastName

* PLT-3140 Add SAML to System Console (#3476)

* PLT-3140 Add SAML to System Console

* Move web_client functions to client.jsx

* Fix issues found by PM

* update package.json mattermost driver

* Fix text messages for SAML
---
 .../user_settings/user_settings_security.jsx       | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'webapp/components/user_settings/user_settings_security.jsx')

diff --git a/webapp/components/user_settings/user_settings_security.jsx b/webapp/components/user_settings/user_settings_security.jsx
index af7aeb3c6..247dc0f81 100644
--- a/webapp/components/user_settings/user_settings_security.jsx
+++ b/webapp/components/user_settings/user_settings_security.jsx
@@ -620,6 +620,24 @@ class SecurityTab extends React.Component {
                 );
             }
 
+            let samlOption;
+            if (global.window.mm_config.EnableSaml === 'true' && user.auth_service === '') {
+                samlOption = (
+                    <div>
+                        <Link
+                            className='btn btn-primary'
+                            to={'/claim/email_to_oauth?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service + '&new_type=' + Constants.SAML_SERVICE}
+                        >
+                            <FormattedMessage
+                                id='user.settings.security.switchSaml'
+                                defaultMessage='Switch to using SAML SSO'
+                            />
+                        </Link>
+                        <br/>
+                    </div>
+                );
+            }
+
             const inputs = [];
             inputs.push(
                 <div key='userSignInOption'>
@@ -627,6 +645,7 @@ class SecurityTab extends React.Component {
                     {gitlabOption}
                     <br/>
                     {ldapOption}
+                    {samlOption}
                     {googleOption}
                 </div>
             );
@@ -681,6 +700,13 @@ class SecurityTab extends React.Component {
                     defaultMessage='LDAP'
                 />
             );
+        } else if (this.props.user.auth_service === Constants.SAML_SERVICE) {
+            describe = (
+                <FormattedMessage
+                    id='user.settings.security.saml'
+                    defaultMessage='SAML'
+                />
+            );
         }
 
         return (
@@ -701,6 +727,7 @@ class SecurityTab extends React.Component {
         numMethods = global.window.mm_config.EnableSignUpWithGitLab === 'true' ? numMethods + 1 : numMethods;
         numMethods = global.window.mm_config.EnableSignUpWithGoogle === 'true' ? numMethods + 1 : numMethods;
         numMethods = global.window.mm_config.EnableLdap === 'true' ? numMethods + 1 : numMethods;
+        numMethods = global.window.mm_config.EnableSaml === 'true' ? numMethods + 1 : numMethods;
 
         let signInSection;
         if (global.window.mm_config.EnableSignUpWithEmail === 'true' && numMethods > 0) {
-- 
cgit v1.2.3-1-g7c22

