Skip to content

Commit

Permalink
MM-18062 - add support for Office365Settings Directory (tenant) Id (m…
Browse files Browse the repository at this point in the history
…attermost#4717)

* MM-18062 - add support for Office365Settings tenantId
  • Loading branch information
catalintomai committed Feb 14, 2020
1 parent 989d9f0 commit 380365f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
25 changes: 23 additions & 2 deletions components/admin_console/admin_definition.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3586,6 +3586,17 @@ const AdminDefinition = {
placeholder_default: 'E.g.: "shAieM47sNBfgl20f8ci294"',
isHidden: it.isnt(it.stateEquals('oauthType', 'office365')),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'Office365Settings.DirectoryId',
label: t('admin.office365.directoryIdTitle'),
label_default: 'Directory (tenant) ID:',
help_text: t('admin.office365.directoryIdDescription'),
help_text_default: 'The Directory (tenant) ID you received when registering your application with Microsoft.',
placeholder: t('admin.office365.directoryIdExample'),
placeholder_default: 'E.g.: "adf3sfa2-ag3f-sn4n-ids0-sh1hdax192qq"',
isHidden: it.isnt(it.stateEquals('oauthType', 'office365')),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,
key: 'Office365Settings.UserApiEndpoint',
Expand All @@ -3600,7 +3611,12 @@ const AdminDefinition = {
key: 'Office365Settings.AuthEndpoint',
label: t('admin.office365.authTitle'),
label_default: 'Auth Endpoint:',
dynamic_value: () => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
dynamic_value: (value, config, state) => {
if (state['Office365Settings.DirectoryId']) {
return 'https://login.microsoftonline.com/' + state['Office365Settings.DirectoryId'] + '/oauth2/v2.0/authorize';
}
return 'https://login.microsoftonline.com/{directoryId}/oauth2/v2.0/authorize';
},
isDisabled: true,
isHidden: it.isnt(it.stateEquals('oauthType', 'office365')),
},
Expand All @@ -3609,7 +3625,12 @@ const AdminDefinition = {
key: 'Office365Settings.TokenEndpoint',
label: t('admin.office365.tokenTitle'),
label_default: 'Token Endpoint:',
dynamic_value: () => 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
dynamic_value: (value, config, state) => {
if (state['Office365Settings.DirectoryId']) {
return 'https://login.microsoftonline.com/' + state['Office365Settings.DirectoryId'] + '/oauth2/v2.0/token';
}
return 'https://login.microsoftonline.com/{directoryId}/oauth2/v2.0/token';
},
isDisabled: true,
isHidden: it.isnt(it.stateEquals('oauthType', 'office365')),
},
Expand Down
3 changes: 3 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,9 @@
"admin.office365.clientSecretDescription": "The Application Secret Password you generated when registering your application with Microsoft.",
"admin.office365.clientSecretExample": "E.g.: \"shAieM47sNBfgl20f8ci294\"",
"admin.office365.clientSecretTitle": "Application Secret Password:",
"admin.office365.directoryIdDescription": "The Directory (tenant) ID you received when registering your application with Microsoft.",
"admin.office365.directoryIdExample": "E.g.: \"adf3sfa2-ag3f-sn4n-ids0-sh1hdax192qq\"",
"admin.office365.directoryIdTitle": "Directory (tenant) ID:",
"admin.office365.EnableMarkdownDesc": "1. [Log in](!https://login.microsoftonline.com/) to your Microsoft or Office 365 account. Make sure it`s the account on the same [tenant](!https://msdn.microsoft.com/en-us/library/azure/jj573650.aspx#Anchor_0) that you would like users to log in with.\n2. Go to [https://apps.dev.microsoft.com](!https://apps.dev.microsoft.com), click **Go to app list** > **Add an app** and use \"Mattermost - your-company-name\" as the **Application Name**.\n3. Under **Application Secrets**, click **Generate New Password** and paste it to the **Application Secret Password** field below.\n4. Under **Platforms**, click **Add Platform**, choose **Web** and enter **your-mattermost-url/signup/office365/complete** (example: https://localhost:8065/signup/office365/complete) under **Redirect URIs**. Also uncheck **Allow Implicit Flow**.\n5. Finally, click **Save** and then paste the **Application ID** below.",
"admin.office365.tokenTitle": "Token Endpoint:",
"admin.office365.userTitle": "User API Endpoint:",
Expand Down

0 comments on commit 380365f

Please sign in to comment.