Родитель
33f781a577
Коммит
2ade9ac256
22
README.md
22
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).
|
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
|
## <a name="supported"></a> Supported SDKs
|
||||||
|
|
||||||
| Package | Min Supported |
|
| Package | Min Supported |
|
||||||
|--|--|
|
|--|--|
|
||||||
| `CommunityToolkit.Authentication` | NetStandard 2.0 |
|
| `CommunityToolkit.Authentication` | NetStandard 2.0 |
|
||||||
| `CommunityToolkit.Authentication.Msal` | NetStandard 2.0 |
|
| `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 17134 |
|
| `CommunityToolkit.Authentication.Uwp` | UWP Windows 10.0.17134.0 |
|
||||||
| `CommunityTookit.Graph` | NetStandard 2.0 |
|
| `CommunityTookit.Graph` | NetStandard 2.0 |
|
||||||
| `CommunityToolkit.Graph.Uwp` | UWP Windows 10 17763 |
|
| `CommunityToolkit.Graph.Uwp` | UWP Windows 10.0.17763.0 |
|
||||||
|
|
||||||
## Samples
|
## Samples
|
||||||
|
|
||||||
|
@ -33,7 +22,8 @@ Check out our samples for getting started with authentication providers and maki
|
||||||
|
|
||||||
- [UwpWindowsProviderSample](./Samples/UwpWindowsProviderSample)
|
- [UwpWindowsProviderSample](./Samples/UwpWindowsProviderSample)
|
||||||
- [UwpMsalProviderSample](./Samples/UwpMsalProviderSample)
|
- [UwpMsalProviderSample](./Samples/UwpMsalProviderSample)
|
||||||
- [WpfMsalProviderSample](./Samples/WpfMsalProviderSample)
|
- [WpfNetCoreMsalProviderSample](./Samples/WpfNetCoreMsalProviderSample)
|
||||||
|
- [WpfNetMsalProviderSample](./Samples/WpfNet5WindowsMsalProviderSample)
|
||||||
- [ManualGraphRequestSample](./Samples/ManualGraphRequestSample)
|
- [ManualGraphRequestSample](./Samples/ManualGraphRequestSample)
|
||||||
|
|
||||||
### Contoso Notes Sample
|
### 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.
|
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
|
### 1A. Setup authentication with MSAL
|
||||||
|
|
||||||
Leverage the official Microsoft Authentication Library (MSAL) to enable authentication in any NetStandard application.
|
Leverage the official Microsoft Authentication Library (MSAL) to enable authentication in any NetStandard application.
|
||||||
|
|
|
@ -1,12 +1,30 @@
|
||||||
# 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.
|
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 ClientId = "YOUR-CLIENT-ID-HERE";
|
||||||
string[] scopes = new string[] { "User.Read" };
|
string[] Scopes = new string[] { "User.Read" };
|
||||||
string redirectUri = "http://localhost";
|
|
||||||
ProviderManager.Instance.GlobalProvider = new MsalProvider(clientId, scopes, redirectUri);
|
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)
|
It uses an IProvider implementation called MsalProvider, which leverages the official Microsoft Authentication Library (MSAL)
|
||||||
|
|
|
@ -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.
|
Загрузка…
Ссылка в новой задаче