[GH-240] Add support for Microsoft National Clouds #428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses #240 to add support for Microsoft National Cloud endpoints.
For my purposes I needed to connect with Microsoft GCC High.
I've added a new config item to select an Azure/Entra ID tenant type with support for Commercial, GCC/GCCH, US Gov (DoD), and China endpoints.
To address the login URLs, I overrode the oauth2/microsoft package to accept the tenant type config entry and return the proper endpoint.
Addressing the MS Graph API endpoints was a little more challenging.
The msgraph module was very out of date and did not support the SetURL function added 4 years ago.
That was added to the module to override the default url of
graph.microsoft.com
.The MSGraph endpoint is controlled using the same new config item and returns the proper graph url.
The tokens used by graph are not cross cloud compatible.
I'm unsure of how to write the unit test mockups in this repo.
Additional Information
This logic could also be applied to the mattermost-plugin-msteams plugin and would address mattermost/mattermost-plugin-msteams#514. However, that issue is not marked as Help Wanted for community contribution. I'd be happy to open a PR for that one too otherwise I will wait for Mattermost Support to resolve it.
Ticket Link
Fixes #240
UI Screenshot