Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,24 @@ 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)

## <a name="supported"></a> 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

Check out our samples for getting started with authentication providers and making calls to Microsoft Graph:

- [UwpWindowsProviderSample](./Samples/UwpWindowsProviderSample)
- [UwpMsalProviderSample](./Samples/UwpMsalProviderSample)
- [WpfMsalProviderSample](./Samples/WpfMsalProviderSample)
- [WpfNetCoreMsalProviderSample](./Samples/WpfNetCoreMsalProviderSample)
- [WpfNetMsalProviderSample](./Samples/WpfNet5WindowsMsalProviderSample)
- [ManualGraphRequestSample](./Samples/ManualGraphRequestSample)

### Contoso Notes Sample
Expand All @@ -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.
Expand Down
30 changes: 24 additions & 6 deletions Samples/WpfNet5WindowsMsalProviderSample/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
# 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);
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.
to enable authentication for MSA and AAD accounts.
31 changes: 31 additions & 0 deletions Samples/WpfNetCoreMsalProviderSample/README.md
Original file line number Diff line number Diff line change
@@ -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.