From be7bd1bcc3ef16a28d940228efed0e4f86541f42 Mon Sep 17 00:00:00 2001 From: Shane Weaver Date: Mon, 25 Oct 2021 14:28:50 -0700 Subject: [PATCH 1/4] Updated README --- README.md | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 1e03264..61a95dd 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,15 @@ Note: This new library replaces the `Microsoft.Toolkit.Uwp.UI.Controls.Graph` pa If you need similar controls for the Web, please use the [Microsoft Graph Toolkit](https://aka.ms/mgt). -## What's new? - -We've overhauled our approach and introduced some big improvements: - -- The new WindowsProvivder enables basic consumer login without AAD configuration 🎊 -- Authentication packages are now split per provider 🎉 -- Access to the GraphServiceClient now lives in a separate package. This means no dependency on the Graph SDK for simple auth scenarios and apps that perform Graph requests manually (sans SDK) 🥳 -- Removed Beta Graph SDK, but enabled access with V1 SDK types. This is so our controls and helpers can be based on the stable Graph endpoint, while also allowing for requests to the beta endpoint in some circumstances (Such as retrieving a user's photo) 🎈 - -For more info on our roadmap, check out the current [Release Plan](https://github.com/CommunityToolkit/Graph-Controls/issues/81) - ## Supported SDKs | Package | Min Supported | |--|--| | `CommunityToolkit.Authentication` | NetStandard 2.0 | -| `CommunityToolkit.Authentication.Msal` | NetStandard 2.0 | -| `CommunityToolkit.Authentication.Uwp` | UWP Windows 10 17134 | +| `CommunityToolkit.Authentication.Msal` | NetStandard 2.0, UWP, .NET 5, .NET 5 Windows 10.0.17763.0, .NET Core 3.1 | +| `CommunityToolkit.Authentication.Uwp` | UWP Windows 10.0.17134.0 | | `CommunityTookit.Graph` | NetStandard 2.0 | -| `CommunityToolkit.Graph.Uwp` | UWP Windows 10 17763 | +| `CommunityToolkit.Graph.Uwp` | UWP Windows 10.0.17763.0 | ## Samples @@ -33,7 +22,8 @@ Check out our samples for getting started with authentication providers and maki - [UwpWindowsProviderSample](./Samples/UwpWindowsProviderSample) - [UwpMsalProviderSample](./Samples/UwpMsalProviderSample) -- [WpfMsalProviderSample](./Samples/WpfMsalProviderSample) +- [WpfNetCoreMsalProviderSample](./Samples/WpfNetCoreMsalProviderSample) +- [WpfNetMsalProviderSample](./Samples/WpfNet5WindowsMsalProviderSample) - [ManualGraphRequestSample](./Samples/ManualGraphRequestSample) ### Contoso Notes Sample @@ -44,8 +34,6 @@ Check out our samples for getting started with authentication providers and maki To get started using Graph data in your application, you'll first need to enable authentication. -> Note: The nuget packages metioned are not yet released, and can be accessed from using our dedicated Nuget feed: [WindowsCommunityToolkit-MainLatest](https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/WindowsCommunityToolkit-MainLatest/nuget/v3/index.json) - ### 1A. Setup authentication with MSAL Leverage the official Microsoft Authentication Library (MSAL) to enable authentication in any NetStandard application. From af7f28f9b5f9d8992262bba2d795ab520ca30f93 Mon Sep 17 00:00:00 2001 From: Shane Weaver Date: Mon, 25 Oct 2021 14:31:37 -0700 Subject: [PATCH 2/4] Updated readme --- .../README.md | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/Samples/WpfNet5WindowsMsalProviderSample/README.md b/Samples/WpfNet5WindowsMsalProviderSample/README.md index 2e2f4e9..83435d7 100644 --- a/Samples/WpfNet5WindowsMsalProviderSample/README.md +++ b/Samples/WpfNet5WindowsMsalProviderSample/README.md @@ -1,13 +1,34 @@ -# MsalProvider Authentication Sample for WPF +# MsalProvider Authentication Sample for .NET 5.0 WPF apps This sample demonstrates how to configure the MsalProvider to authenticate consumer MSA and organizational AAD accounts in your apps. ``` string clientId = "YOUR-CLIENT-ID-HERE"; string[] scopes = new string[] { "User.Read" }; -string redirectUri = "http://localhost"; -ProviderManager.Instance.GlobalProvider = new MsalProvider(clientId, scopes, redirectUri); + +if (ProviderManager.Instance.GlobalProvider == null) +{ + var provider = new MsalProvider(ClientId, Scopes, null, false, true); + + // Configure the token cache storage for non-UWP applications. + var storageProperties = new StorageCreationPropertiesBuilder(CacheConfig.CacheFileName, CacheConfig.CacheDir) + .WithLinuxKeyring( + CacheConfig.LinuxKeyRingSchema, + CacheConfig.LinuxKeyRingCollection, + CacheConfig.LinuxKeyRingLabel, + CacheConfig.LinuxKeyRingAttr1, + CacheConfig.LinuxKeyRingAttr2) + .WithMacKeyChain( + CacheConfig.KeyChainServiceName, + CacheConfig.KeyChainAccountName) + .Build(); + await provider.InitTokenCacheAsync(storageProperties); + + ProviderManager.Instance.GlobalProvider = provider; + + await provider.TrySilentSignInAsync(); +} ``` It uses an IProvider implementation called MsalProvider, which leverages the official Microsoft Authentication Library (MSAL) -to enable authentication for MSA and AAD accounts. \ No newline at end of file +to enable authentication for MSA and AAD accounts. From a87acd86bef5542b7c9a0e21efc3b026fbe0714f Mon Sep 17 00:00:00 2001 From: Shane Weaver Date: Mon, 25 Oct 2021 14:33:20 -0700 Subject: [PATCH 3/4] Updated readme --- .../WpfNetCoreMsalProviderSample/README.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Samples/WpfNetCoreMsalProviderSample/README.md diff --git a/Samples/WpfNetCoreMsalProviderSample/README.md b/Samples/WpfNetCoreMsalProviderSample/README.md new file mode 100644 index 0000000..987e9e1 --- /dev/null +++ b/Samples/WpfNetCoreMsalProviderSample/README.md @@ -0,0 +1,31 @@ +# MsalProvider Authentication Sample for .NET Core 3.1 WPF apps + +This sample demonstrates how to configure the MsalProvider to authenticate consumer MSA and organizational AAD accounts in your apps. + +``` +string ClientId = "YOUR-CLIENT-ID-HERE"; +string[] Scopes = new string[] { "User.Read" }; + +var provider = new MsalProvider(ClientId, Scopes, null, false, true); + +// Configure the token cache storage for non-UWP applications. +var storageProperties = new StorageCreationPropertiesBuilder(CacheConfig.CacheFileName, CacheConfig.CacheDir) + .WithLinuxKeyring( + CacheConfig.LinuxKeyRingSchema, + CacheConfig.LinuxKeyRingCollection, + CacheConfig.LinuxKeyRingLabel, + CacheConfig.LinuxKeyRingAttr1, + CacheConfig.LinuxKeyRingAttr2) + .WithMacKeyChain( + CacheConfig.KeyChainServiceName, + CacheConfig.KeyChainAccountName) + .Build(); +await provider.InitTokenCacheAsync(storageProperties); + +ProviderManager.Instance.GlobalProvider = provider; + +await provider.TrySilentSignInAsync(); +``` + +It uses an IProvider implementation called MsalProvider, which leverages the official Microsoft Authentication Library (MSAL) +to enable authentication for MSA and AAD accounts. From 39efdfa037341ea63171d2ae3bfc152c326f59cf Mon Sep 17 00:00:00 2001 From: Shane Weaver Date: Mon, 25 Oct 2021 14:33:57 -0700 Subject: [PATCH 4/4] Updated readme --- .../README.md | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/Samples/WpfNet5WindowsMsalProviderSample/README.md b/Samples/WpfNet5WindowsMsalProviderSample/README.md index 83435d7..c57018b 100644 --- a/Samples/WpfNet5WindowsMsalProviderSample/README.md +++ b/Samples/WpfNet5WindowsMsalProviderSample/README.md @@ -3,31 +3,28 @@ This sample demonstrates how to configure the MsalProvider to authenticate consumer MSA and organizational AAD accounts in your apps. ``` -string clientId = "YOUR-CLIENT-ID-HERE"; -string[] scopes = new string[] { "User.Read" }; +string ClientId = "YOUR-CLIENT-ID-HERE"; +string[] Scopes = new string[] { "User.Read" }; -if (ProviderManager.Instance.GlobalProvider == null) -{ - var provider = new MsalProvider(ClientId, Scopes, null, false, true); +var provider = new MsalProvider(ClientId, Scopes, null, false, true); - // Configure the token cache storage for non-UWP applications. - var storageProperties = new StorageCreationPropertiesBuilder(CacheConfig.CacheFileName, CacheConfig.CacheDir) - .WithLinuxKeyring( - CacheConfig.LinuxKeyRingSchema, - CacheConfig.LinuxKeyRingCollection, - CacheConfig.LinuxKeyRingLabel, - CacheConfig.LinuxKeyRingAttr1, - CacheConfig.LinuxKeyRingAttr2) - .WithMacKeyChain( - CacheConfig.KeyChainServiceName, - CacheConfig.KeyChainAccountName) - .Build(); - await provider.InitTokenCacheAsync(storageProperties); +// Configure the token cache storage for non-UWP applications. +var storageProperties = new StorageCreationPropertiesBuilder(CacheConfig.CacheFileName, CacheConfig.CacheDir) + .WithLinuxKeyring( + CacheConfig.LinuxKeyRingSchema, + CacheConfig.LinuxKeyRingCollection, + CacheConfig.LinuxKeyRingLabel, + CacheConfig.LinuxKeyRingAttr1, + CacheConfig.LinuxKeyRingAttr2) + .WithMacKeyChain( + CacheConfig.KeyChainServiceName, + CacheConfig.KeyChainAccountName) + .Build(); +await provider.InitTokenCacheAsync(storageProperties); - ProviderManager.Instance.GlobalProvider = provider; +ProviderManager.Instance.GlobalProvider = provider; - await provider.TrySilentSignInAsync(); -} +await provider.TrySilentSignInAsync(); ``` It uses an IProvider implementation called MsalProvider, which leverages the official Microsoft Authentication Library (MSAL)