Skip to content

Commit eab0342

Browse files
authored
Merge pull request #536 from MicrosoftDocs/master
Update to LIVE
2 parents 4bd3caf + 10158df commit eab0342

20 files changed

+454
-338
lines changed

.openpublishing.redirection.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"redirections": [
3+
{
4+
"source_path": "archive/graph/providers/InteractiveProviderBehavior.md",
5+
"redirect_url": "/graph/providers/interactiveproviderbehavior",
6+
"redirect_document_id": true
7+
},
8+
{
9+
"source_path": "archive/graph/providers/MockProviderBehavior.md",
10+
"redirect_url": "/graph/providers/mockproviderbehavior",
11+
"redirect_document_id": true
12+
},
13+
{
14+
"source_path": "graph/authentication/msal.md",
15+
"redirect_url": "/graph/authentication/msalprovider",
16+
"redirect_document_id": true
17+
},
18+
{
19+
"source_path": "graph/authentication/windows.md",
20+
"redirect_url": "/graph/authentication/windowsprovider",
21+
"redirect_document_id": true
22+
},
23+
{
24+
"source_path": "graph/authentication/custom.md",
25+
"redirect_url": "/graph/authentication/iprovider",
26+
"redirect_document_id": true
27+
}
28+
]
29+
}

docs/Getting-Started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The toolkit is available as NuGet packages that can be added to any existing or
1414
> [!NOTE]
1515
> Visual Studio 2015 is not supported with the Windows Community Toolkit 2.0 or higher
1616
17-
2. Open an existing project, or create a new project using the Blank App template under Visual C# -> Windows -> Universal. **Important**: Build 16299 or higher is supported by current version of the Toolkit.
17+
2. Open an existing project, or create a new project using the Blank App template under Visual C# -> Windows -> Universal. **Important**: Version 1809 (Build 17763) or higher is supported by current version of the Toolkit.
1818

1919
3. In Solution Explorer panel, right click on your project name and select **Manage NuGet Packages**. Search for **Microsoft.Toolkit.UWP**, and choose your desired [NuGet Packages](Nuget-Packages.md) from the list.
2020

docs/graph/providers/InteractiveProviderBehavior.md renamed to docs/archive/graph/providers/InteractiveProviderBehavior.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dev_langs:
1010
# InteractiveProviderBehavior XAML Behavior
1111

1212
> [!WARNING]
13-
> This API has been removed. For the latest guidance on using the Microsoft Graph in the Toolkit check out the [Windows Community Toolkit - Graph Helpers and Controls](../overview.md).
13+
> This API has been removed. For the latest guidance on using the Microsoft Graph in the Toolkit check out the [Windows Community Toolkit - Graph Helpers and Controls](../../../graph/overview.md).
1414
1515
The [InteractiveProviderBehavior](/dotnet/api/microsoft.toolkit.graph.providers.interactiveproviderbehavior) provides a quick and easy way to connect to the Microsoft Identity platform and Microsoft Graph. It is built on top of the Graph SDK's authentication providers, but allows usage from XAML.
1616

docs/graph/providers/MockProviderBehavior.md renamed to docs/archive/graph/providers/MockProviderBehavior.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dev_langs:
1010
# MockProviderBehavior XAML Behavior
1111

1212
> [!WARNING]
13-
> This API has been removed. For the latest guidance on using the Microsoft Graph in the Toolkit check out the [Windows Community Toolkit - Graph Helpers and Controls](../overview.md).
13+
> This API has been removed. For the latest guidance on using the Microsoft Graph in the Toolkit check out the [Windows Community Toolkit - Graph Helpers and Controls](../../../graph/overview.md).
1414
1515
<!-- Describe your control -->
1616
The [MockProviderBehavior](/dotnet/api/microsoft.toolkit.graph.providers.mockproviderbehavior) provides sample data from the Microsoft Graph for demonstration and learning purposes only.

docs/docfx.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"uhfHeaderId": "MSDocsHeader-UWP-Community",
4444
"ms.topic": "article",
4545
"ms.prod": "community-toolkit",
46+
"products": ["https://authoring-docs-microsoft.poolparty.biz/devrel/bcbcbad5-4208-4783-8035-8481272c98b8"],
4647
"keywords": "windows uwp community toolkit",
4748
"author": "michael-hawker",
4849
"ms.author": "mhawker",

docs/extensions/OnDeviceExtension.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,3 @@ Here is how the property can be used in XAML:
1919
Text="{ui:OnDevice Default=Hi, Desktop=Hello, Xbox=World}"/>
2020

2121
```
22-
23-
## Examples
24-
25-
You can find more examples in the [unit tests](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/rel/7.0.0/UnitTests).

docs/graph/authentication/MsalProvider.md

Lines changed: 0 additions & 68 deletions
This file was deleted.

docs/graph/authentication/ProviderManager.md

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,13 @@ dev_langs:
99

1010
# ProviderManager
1111

12-
The ProviderManager manages access to the globally configured [IProvider](./IProvider.md) instance and any state change events as users sign in and out.
12+
The ProviderManager manages access to the globally configured [IProvider](./custom.md) instance and any state change events as users sign in and out.
1313

1414
> Available in the `CommunityToolkit.Authentication` package.
1515
1616
> [!IMPORTANT]
1717
> Windows Community Toolkit - Graph Controls and Helpers packages are in preview. To get started using WCT preview packages visit the [WCT Preview Packages wiki page](https://aka.ms/wct/wiki/previewpackages).
1818
19-
## Set the GlobalProvider
20-
21-
```csharp
22-
using CommunityToolkit.Authentication;
23-
24-
ProviderManager.Instance.GlobalProvider = new WindowsProvider();
25-
```
26-
27-
## Listen for changes to the GlobalProvider
28-
29-
```csharp
30-
using CommunityToolkit.Authentication;
31-
32-
ProviderManager.Instance.ProviderUpdated += OnProviderUpdated;
33-
34-
void OnProviderUpdated(object sender, ProviderUpdatedEventArgs e)
35-
{
36-
if (e.Reason == ProviderManagerChangedState.ProviderUpdated)
37-
{
38-
// The GlobalProvider has been set.
39-
}
40-
41-
if (e.Reason == ProviderManagerChangedState.ProviderStateChanged)
42-
{
43-
// The GlobalProvider state has changed.
44-
}
45-
}
46-
```
47-
4819
## Properties
4920

5021
| Property | Type | Description |
@@ -55,27 +26,20 @@ void OnProviderUpdated(object sender, ProviderUpdatedEventArgs e)
5526

5627
| Event | Type | Description |
5728
| -- | -- | -- |
58-
| ProviderUpdated | EventHandler&lt;ProviderUpdatedEventArgs&gt; | Event called when the IProvider changes. |
59-
60-
## Methods
61-
62-
| Method | Arguments | Returns | Description |
63-
| -- | -- | -- | -- |
64-
| AuthenticateRequestAsync | HttpRequestMessage | Task | Authenticate an outgoing request. |
65-
| GetTokenAsync | bool silentOnly = true | Task&lt;string&gt; | Retrieve a token for the authenticated user. |
66-
| SignInAsync | | Task | Sign in a user. |
67-
| SignOutAsync | | Task | Sign out the current user. |
68-
| TrySilentSignInAsync | | Task&lt;bool&gt; | Try signing in silently, without prompts. |
29+
| ProviderUpdated | EventHandler&lt;IProvider&gt; | Event called when the IProvider changes. |
30+
| ProviderStateChanged | EventHandler&lt;ProviderStateChangedEventArgs&gt; | Event called when the IProvider changes. |
6931

70-
## ProviderUpdatedEventArgs Object
32+
## ProviderStateChangedEventArgs Object
7133

7234
| Property | Type | Description |
7335
| -- | -- | -- |
74-
| Reason | ProviderManagerChangedState | Gets the reason for the provider update. |
36+
| OldState | ProviderState | Gets the previous state of the IProvider.
37+
| NewState | ProviderState | Gets the new state of the IProvider.
7538

76-
## ProviderManagerChangedState Enum
39+
## ProviderState Enum
7740

7841
| Name | Description |
7942
| -- | -- |
80-
| ProviderStateChanged | The [IProvider](./IProvider.md) state has changed.|
81-
| ProviderUpdated | The [IProvider](./IProvider.md) itself has changed. |
43+
| Loading | The user's status is not known. |
44+
| SignedOut | The user is signed-out. |
45+
| SignedIn | The user is signed-in. |

docs/graph/authentication/IProvider.md renamed to docs/graph/authentication/custom.md

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ dev_langs:
77
- csharp
88
---
99

10-
# IProvider
10+
# Custom provider
1111

12-
The IProvider is the base interface for creating authentication providers that work with the various controls and helpers in the toolkit.
12+
If you have existing authentication code in your application, you can create a custom provider to enable authentication and access to Microsoft Graph for the toolkit's Graph based controls and helpers. To bring your own authentication provider logic, start by extending `IProvider`.
13+
14+
## IProvider
15+
16+
`IProvider` is the base interface for creating authentication providers that work with the various controls and helpers in the toolkit. Handle authenticaiton with one of our premade `IProvider` implementations or create your own.
1317

1418
> Available in the `CommunityToolkit.Authentication` package.
1519
@@ -19,47 +23,31 @@ The IProvider is the base interface for creating authentication providers that w
1923
```csharp
2024
using CommunityToolkit.Authentication;
2125

22-
IProvider provider = ProviderManager.Instance.GlobalProvider;
26+
// Create an instance of your custom IProvider implementation.
27+
IProvider customProvider = new CustomProvider();
2328

24-
if (provider?.State == ProviderState.SignedIn)
25-
{
26-
// You are now signed in and can request access tokens.
27-
}
29+
// Set the global provider using the custom instance.
30+
ProviderManager.Instance.GlobalProvider = customProvider;
2831
```
2932

30-
## Properties
33+
### Properties
3134

3235
| Property | Type | Description |
3336
| -- | -- | -- |
3437
| State | ProviderState | Gets the current authentication state of the provider. |
3538

36-
## Events
39+
### Events
3740

3841
| Event | Type | Description |
3942
| -- | -- | -- |
4043
| StateChanged | EventHandler&lt;ProviderStateChangedEventArgs&gt; | An event that is called whenever the login state changes.
4144

42-
## Methods
45+
### Methods
4346

4447
| Method | Arguments | Returns | Description |
4548
| -- | -- | -- | -- |
4649
| AuthenticateRequestAsync | HttpRequestMessage | Task | Authenticate an outgoing request. |
47-
| GetTokenAsync | bool silentOnly = true | Task&lt;string&gt; | Retrieve a token for the authenticated user. |
50+
| GetTokenAsync | bool silentOnly = false, string[] scopes = null | Task&lt;string&gt; | Retrieve a token for the authenticated user. |
4851
| SignInAsync | | Task | Sign in a user. |
4952
| SignOutAsync | | Task | Sign out the current user. |
5053
| TrySilentSignInAsync | | Task&lt;bool&gt; | Try signing in silently, without prompts. |
51-
52-
## ProviderStateChangedEventArgs Object
53-
54-
| Property | Type | Description |
55-
| -- | -- | -- |
56-
| OldState | ProviderState | Gets the previous state of the IProvider.
57-
| NewState | ProviderState | Gets the new state of the IProvider.
58-
59-
## ProviderState Enum
60-
61-
| Name | Description |
62-
| -- | -- |
63-
| Loading | The user's status is not known. |
64-
| SignedOut | The user is signed-out. |
65-
| SignedIn | The user is signed-in. |

docs/graph/authentication/msal.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: MsalProvider
3+
author: shweaver-MSFT
4+
description: Authentication provider based on the official Microsoft Authentication Library (MSAL).
5+
keywords: uwp, wpf, netstandard, windows, community, toolkit, graph, login, authentication, provider, providers, identity, msal
6+
dev_langs:
7+
- csharp
8+
---
9+
10+
# MsalProvider
11+
12+
The MsalProvider is an [IProvider](./custom.md) implementation built on the official Microsoft Authentication Library (MSAL). It is NetStandard 2.0 so it works in both UWP and WPF apps.
13+
14+
> Available in the `CommunityToolkit.Authentication.Msal` package.
15+
16+
> [!IMPORTANT]
17+
> Windows Community Toolkit - Graph Controls and Helpers packages are in preview. To get started using WCT preview packages visit the [WCT Preview Packages wiki page](https://aka.ms/wct/wiki/previewpackages).
18+
19+
```csharp
20+
using CommunityToolkit.Authentication;
21+
22+
string clientId = "YOUR-CLIENT-ID-HERE";
23+
string[] scopes = new string[] { "User.Read" };
24+
25+
ProviderManager.Instance.GlobalProvider = new MsalProvider(clientId, scopes);
26+
```
27+
28+
## Prerequisite Configure Client Id in Partner Center
29+
30+
> [!IMPORTANT]
31+
> To obtain a Client Id, first register your app in Azure following the guidance here: [Quickstart: Register an application with the Microsoft identity platform](/azure/active-directory/develop/quickstart-register-app)
32+
>
33+
> After finishing the initial registration, you will also need to add an additional redirect URI. Click on "Authentication -> Add a Platform", select "Mobile and desktop applications", and check the "https://login.microsoftonline.com/common/oauth2/nativeclient" checkbox on that page. Then click "Configure".
34+
35+
## Constructor
36+
37+
| Parameter | Type | Default | Description |
38+
| -- | -- | -- | -- |
39+
| clientId | string | | Registered client id. |
40+
| scopes | string[] | null | Listof scopes to initially request. |
41+
| redirectUri | string | `https://login.microsoftonline.com/common/oauth2/nativeclient` | Redirect URI for authentication response. |
42+
| autoSignIn | bool | true | Determines whether the provider attempts to silently log in upon instantiation. |
43+
44+
## Properties
45+
46+
| Property | Type | Description |
47+
| -- | -- | -- |
48+
| State | ProviderState | Gets the current authentication state of the provider. |
49+
50+
## Events
51+
52+
| Event | Type | Description |
53+
| -- | -- | -- |
54+
| StateChanged | EventHandler&lt;ProviderStateChangedEventArgs&gt; | Event called when the provider state changes. |
55+
56+
## Methods
57+
58+
| Method | Arguments | Returns | Description |
59+
| -- | -- | -- | -- |
60+
| GetTokenAsync | bool silentOnly = false, string[] scopes = null | Task&lt;string&gt; | Retrieve a token for the authenticated user. |
61+
| AuthenticateRequestAsync | HttpRequestMessage | Task | Authenticate an outgoing request. |
62+
| SignInAsync | | Task | Sign in a user. |
63+
| SignOutAsync | | Task | Sign out the current user. |
64+
| TrySilentSignInAsync | | Task&lt;bool&gt; | Try signing in silently, without prompts. |

0 commit comments

Comments
 (0)