CommunityToolkit / Graph-Controls

Set of Helpers and Controls for Windows development using the Microsoft Graph.
https://docs.microsoft.com/en-us/windows/communitytoolkit/graph/overview
Other
154 stars 39 forks source link

[Feature] Enable MsalProvider to use the native account broker #168

Closed shweaver-MSFT closed 2 years ago

shweaver-MSFT commented 2 years ago

Describe the problem this feature would solve

Currently the MsalProvider throws the web based authentication prompt every time. Even though the native broker is available, we don't use it.

Describe the solution

There is an option PublicClientApplicationBuilder.WithBroker() that can be used during the construction of the IPublicClientApplication object in the MsalProvider constructor. This shows the native account picker instead of the web based prompt, which lacks convenience features like already knowing who you are based on the current Windows login.

This feature should be enabled without breaking the MsalProvider. A configuration parameter should be added to the constructor to hold config values with defaults:

class MsalProviderConfiguration
{
    // Use this to turn the native account broker on/off
    public bool UseBroker { get; set; } = true;

    // Use this to indicate the authority and which account types should be supported.
    public bool ListWindowsWorkAndSchoolAccounts { get; set; } = true;
}

Describe alternatives you've considered

Additional context & Screenshots