-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for GCC and other sovereign clouds #1928
Conversation
base-url specifies a base url for the graph client config. It is optional and defaults to https://graph.microsoft.com. With this attribute, you can pass in any of the GCC and national clouds urls
Thank you for creating a Pull Request @musale. This is a checklist for the PR reviewer(s) to complete before approving and merging this PR:
|
Would love to see in the PR some of the usage on different providers. Probably via the packages README? |
Yes! I'm doing incremental updates per provider BUT on this same PR. The final result is all providers supporting the approach and fully documented in all the relevant places. |
You can set a baseURL when calling the electron provider. Additional refactors to fix tsc errors
Since it uses Msal2Provider, all we do is pass the base URL where Msal2Provider is called
Since it uses MsalProvider, all we do is pass the base URL where MsalProvider is called
The baseUrl is passed during initialization. The default is already set to MICROSOFT_GRAPH_DEFAULT_ENDPOINT
…raph-toolkit into musale/support-gcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite clear why we're doing so much repeated work in each of the providers and not pushing that work to the base classes.
Oh my! That completely escaped my refactors. Let me mop up and hopefully reduce the changes. |
packages/providers/mgt-electron-provider/src/Authenticator/ElectronAuthenticator.ts
Outdated
Show resolved
Hide resolved
packages/providers/mgt-electron-provider/src/Authenticator/ElectronAuthenticator.ts
Show resolved
Hide resolved
…raph-toolkit into musale/support-gcc
…oft-graph-toolkit into musale/support-gcc
Co-authored-by: Gavin Barron <[email protected]>
* feat: add support for configuring the base URL in the graph client * feat: add base-url attribute to Msal2Provider base-url specifies a base url for the graph client config. It is optional and defaults to https://graph.microsoft.com. With this attribute, you can pass in any of the GCC and national clouds urls * refactor: use GraphEndpoint type instead of string * refactor: move validating base URL to utility function * fix: use new URL().origin to validate the base URL * feat: set baseURL when you initialize with clientID * feat: update the types on the declared variable * fix: cast string to GraphEndpoint type in validation * feat: update MsalProvider to use base-url property * feat: update the ElectronProvider to set a baseURL You can set a baseURL when calling the electron provider. Additional refactors to fix tsc errors * feat: add base url to Sharepoint provider * feat: add base-url attribute to TeamsMsal2Provider Since it uses Msal2Provider, all we do is pass the base URL where Msal2Provider is called * feat: add base-url attribute to TeamsMsalProvider Since it uses MsalProvider, all we do is pass the base URL where MsalProvider is called * feat: add base-url attribute to TeamsFxProvider The baseUrl is passed during initialization. The default is already set to MICROSOFT_GRAPH_DEFAULT_ENDPOINT * feat: change to validating the baseUrl before initializing the client * refactor: set the baseURL default value in constractor * refactor: set the baseURL default value in constructor * feat: add base-url to the baseProvider * refactor: remove re-declaration of property in base class * fix: validate base URL string in the IProvider * fix: do the validation when setting the baseURL * refactor/docs: use one check to get all accounts and document the exported types * fix: remove duplicate import * fix: set licence text on all files * fix: updaet the memberof value of the base provider Co-authored-by: Gavin Barron <[email protected]> Co-authored-by: Gavin Barron <[email protected]>
Closes #1030
PR Type
Description of the changes
baseUrl
config value. By default, it is https://graph.microsoft.com but you can now set it to any of these:base-url
in theMSAL2Provider
,MsalProvider
,TeamsMsalProvider
,TeamsMsal2Provider
to allow setting the base URL you want to use in the graph client.baseURL
argument toElectronProvider
,SharepointProvider
and.handleAuth()
method in the teams providers.PR checklist
yarn build
) and changes have been tested in at least two supported browsers (Edge + non-Chromium based browser)yarn setLicense
)Other information
You can set the
baseURL
when initializing your provider like this:Usage
This sets the
baseUrl
for theMSAL2Provider
,MsalProvider
,TeamsMsalProvider
andTeamsMsal2Provider
.In Teams, you have to call
handleAuth
first to handle all client side auth or permission consent.This sets the
baseURL
forElectronProvider
This sets the
baseURL
forSharePointProvider