You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/debug.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ To debug a Blazor WebAssembly app in Visual Studio:
77
77
> [!NOTE]
78
78
> **Start Without Debugging** (<kbd>Ctrl</kbd>+<kbd>F5</kbd>) isn't supported. When the app is run in Debug configuration, debugging overhead always results in a small performance reduction.
79
79
80
-
1. In the *Client* app, set a breakpoint on the `currentCount++;` line in `Pages/Counter.razor`.
80
+
1. In the `*Client*` app, set a breakpoint on the `currentCount++;` line in `Pages/Counter.razor`.
81
81
1. In the browser, navigate to `Counter` page and select the **Click me** button to hit the breakpoint.
82
82
1. In Visual Studio, inspect the value of the `currentCount` field in the **Locals** window.
83
83
1. Press <kbd>F5</kbd> to continue execution.
@@ -164,7 +164,7 @@ For information on using a custom app base path for Blazor WebAssembly apps, see
164
164
165
165
1. The standalone app is launched, and a debugging browser is opened.
166
166
167
-
1. In the *Client* app, set a breakpoint on the `currentCount++;` line in `Pages/Counter.razor`.
167
+
1. In the `*Client*` app, set a breakpoint on the `currentCount++;` line in `Pages/Counter.razor`.
168
168
169
169
1. In the browser, navigate to `Counter` page and select the **Click me** button to hit the breakpoint.
170
170
@@ -269,7 +269,7 @@ To debug a Blazor WebAssembly app in Visual Studio for Mac:
269
269
> [!IMPORTANT]
270
270
> Google Chrome or Microsoft Edge must be the selected browser for the debugging session.
271
271
272
-
1. In the *Client* app, set a breakpoint on the `currentCount++;` line in `Pages/Counter.razor`.
272
+
1. In the `*Client*` app, set a breakpoint on the `currentCount++;` line in `Pages/Counter.razor`.
273
273
1. In the browser, navigate to `Counter` page and select the **Click me** button to hit the breakpoint:
274
274
1. In Visual Studio, inspect the value of the `currentCount` field in the **Locals** window.
275
275
1. Press <kbd>⌘</kbd>+<kbd>↩</kbd> to continue execution.
Copy file name to clipboardExpand all lines: aspnetcore/blazor/security/webassembly/additional-scenarios.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,7 +161,7 @@ For a Blazor app based on the Blazor WebAssembly Hosted project template, <xref:
161
161
162
162
### Graph API example
163
163
164
-
In the following example, a named <xref:System.Net.Http.HttpClient> for Graph API is used to obtain a user's mobile phone number to process a call. After adding the Microsoft Graph API `User.Read` permission in the AAD area of the Azure portal, the scope is configured for the named client in the standalone app or Client app of a hosted Blazor solution.
164
+
In the following example, a named <xref:System.Net.Http.HttpClient> for Graph API is used to obtain a user's mobile phone number to process a call. After adding the Microsoft Graph API `User.Read` permission in the AAD area of the Azure portal, the scope is configured for the named client in the standalone app or *`Client`* app of a hosted Blazor solution.
165
165
166
166
> [!NOTE]
167
167
> The example in this section obtains Graph API data for the user in *component code*. To create user claims from Graph API, see the following resources:
@@ -1054,7 +1054,7 @@ After following the guidance in one of the hosted Blazor WebAssembly app topics,
1054
1054
* Prerenders paths for which authorization isn't required.
1055
1055
* Doesn't prerender paths for which authorization is required.
1056
1056
1057
-
In the Client app's `Program` class (`Program.cs`), factor common service registrations into a separate method (for example, `ConfigureCommonServices`):
1057
+
In the *`Client`* app's `Program` class (`Program.cs`), factor common service registrations into a separate method (for example, `ConfigureCommonServices`):
In the server app, create a `Pages` folder if it doesn't exist. Create a `_Host.cshtml` page inside the server app's `Pages` folder. Paste the contents from the Client app's `wwwroot/index.html` file into the `Pages/_Host.cshtml` file. Update the file's contents:
1117
+
In the server app, create a `Pages` folder if it doesn't exist. Create a `_Host.cshtml` page inside the server app's `Pages` folder. Paste the contents from the *`Client`* app's `wwwroot/index.html` file into the `Pages/_Host.cshtml` file. Update the file's contents:
1118
1118
1119
1119
* Add `@page "_Host"` to the top of the file.
1120
1120
* Replace the `<app>Loading...</app>` tag with the following:
Copy file name to clipboardExpand all lines: aspnetcore/blazor/security/webassembly/azure-active-directory-groups-and-roles.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ The guidance in this article applies to the Blazor WebAssembly AAD deployment sc
33
33
34
34
A [Microsoft Graph API](/graph/use-the-api) call is required for any app user with more than five AAD Administrator role and security group memberships.
35
35
36
-
To permit Graph API calls, give the standalone or client app of a hosted Blazor solution any of the following [Graph API permissions](/graph/permissions-reference) in the Azure portal:
36
+
To permit Graph API calls, give the standalone or *`Client`* app of a hosted Blazor solution any of the following [Graph API permissions](/graph/permissions-reference) in the Azure portal:
37
37
38
38
*`Directory.Read.All`
39
39
*`Directory.ReadWrite.All`
@@ -72,7 +72,7 @@ public class CustomUserAccount : RemoteUserAccount
72
72
}
73
73
```
74
74
75
-
In the standalone app or the client app of a hosted Blazor solution, create a custom <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.AuthorizationMessageHandler> class. Use the correct scope (permission) for Graph API calls that obtain role and group information.
75
+
In the standalone app or the *`Client`* app of a hosted Blazor solution, create a custom <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.AuthorizationMessageHandler> class. Use the correct scope (permission) for Graph API calls that obtain role and group information.
76
76
77
77
`GraphAPIAuthorizationMessageHandler.cs`:
78
78
@@ -234,7 +234,7 @@ There's no need to provide code to remove the original `groups` claim, if presen
234
234
>
235
235
> General coverage for this approach is found in the <xref:blazor/security/webassembly/additional-scenarios#custom-authorizationmessagehandler-class> article.
236
236
237
-
Register the factory in `Program.Main` (`Program.cs`) of the standalone app or client app of a hosted Blazor solution. Consent to the `Directory.Read.All` permission scope as an additional scope for the app:
237
+
Register the factory in `Program.Main` (`Program.cs`) of the standalone app or *`Client`* app of a hosted Blazor solution. Consent to the `Directory.Read.All` permission scope as an additional scope for the app:
@@ -635,9 +635,9 @@ The following example assumes that an app is configured with two roles:
635
635
636
636
The single `roles` claim sent by AAD presents the user-defined roles as the `appRoles`'s `value`s in a JSON array. The app must convert the JSON array of roles into individual `role` claims.
637
637
638
-
The `CustomUserFactory` shown in the [User-defined groups and AAD Administrator Roles](#user-defined-groups-and-administrator-roles) section is set up to act on a `roles` claim with a JSON array value. Add and register the `CustomUserFactory` in the standalone app or client app of a hosted Blazor solution as shown in the [User-defined groups and AAD Administrator Roles](#user-defined-groups-and-administrator-roles) section. There's no need to provide code to remove the original `roles` claim because it's automatically removed by the framework.
638
+
The `CustomUserFactory` shown in the [User-defined groups and AAD Administrator Roles](#user-defined-groups-and-administrator-roles) section is set up to act on a `roles` claim with a JSON array value. Add and register the `CustomUserFactory` in the standalone app or *`Client`* app of a hosted Blazor solution as shown in the [User-defined groups and AAD Administrator Roles](#user-defined-groups-and-administrator-roles) section. There's no need to provide code to remove the original `roles` claim because it's automatically removed by the framework.
639
639
640
-
In `Program.Main` of the standalone app or client app of a hosted Blazor solution, specify the claim named "`role`" as the role claim:
640
+
In `Program.Main` of the standalone app or *`Client`* app of a hosted Blazor solution, specify the claim named "`role`" as the role claim:
Copy file name to clipboardExpand all lines: aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md
+47-11Lines changed: 47 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Follow the guidance in [Tutorial: Register an application in Azure Active Direct
31
31
1. Provide a **Name** for the app (for example, **Blazor Server AAD B2C**).
32
32
1. For **Supported account types**, select the multi-tenant option: **Accounts in any organizational directory or any identity provider. For authenticating users with Azure AD B2C.**
33
33
1. The *Server API app* doesn't require a **Redirect URI** in this scenario, so leave the drop down set to **Web** and don't enter a redirect URI.
34
-
1. Confirm that **Permissions** > **Grant admin consent to openid and offline_access permissions** is enabled.
34
+
1. Confirm that **Permissions** > **Grant admin consent to openid and offline_access permissions** is selected.
35
35
1. Select **Register**.
36
36
37
37
Record the following information:
@@ -58,13 +58,35 @@ The App ID URI might require a special configuration in the client app, which is
58
58
59
59
### Register a client app
60
60
61
-
Follow the guidance in [Tutorial: Register an application in Azure Active Directory B2C](/azure/active-directory-b2c/tutorial-register-applications) again to register an AAD app for the *Client app* and then do the following:
61
+
Follow the guidance in [Tutorial: Register an application in Azure Active Directory B2C](/azure/active-directory-b2c/tutorial-register-applications) again to register an AAD app for the *`Client`* app and then do the following:
62
+
63
+
::: moniker range=">= aspnetcore-5.0"
62
64
63
65
1. In **Azure Active Directory** > **App registrations**, select **New registration**.
64
66
1. Provide a **Name** for the app (for example, **Blazor Client AAD B2C**).
65
67
1. For **Supported account types**, select the multi-tenant option: **Accounts in any organizational directory or any identity provider. For authenticating users with Azure AD B2C.**
66
-
1. Leave the **Redirect URI** drop down set to **Web** and provide the following redirect URI: `https://localhost:{PORT}/authentication/login-callback`. The default port for an app running on Kestrel is 5001. If the app is run on a different Kestrel port, use the app's port. For IIS Express, the randomly generated port for the app can be found in the Server app's properties in the **Debug** panel. Since the app doesn't exist at this point and the IIS Express port isn't known, return to this step after the app is created and update the redirect URI. A remark appears in the [Create the app](#create-the-app) section to remind IIS Express users to update the redirect URI.
67
-
1. Confirm that **Permissions** > **Grant admin consent to openid and offline_access permissions** is enabled.
68
+
1. Set the **Redirect URI** drop down to **Single-page application (SPA)** and provide the following redirect URI: `https://localhost:{PORT}/authentication/login-callback`. The default port for an app running on Kestrel is 5001. If the app is run on a different Kestrel port, use the app's port. For IIS Express, the randomly generated port for the app can be found in the *`Server`* app's properties in the **Debug** panel. Since the app doesn't exist at this point and the IIS Express port isn't known, return to this step after the app is created and update the redirect URI. A remark appears in the [Create the app](#create-the-app) section to remind IIS Express users to update the redirect URI.
69
+
1. Confirm that **Permissions** > **Grant admin consent to openid and offline_access permissions** is selected.
70
+
1. Select **Register**.
71
+
72
+
1. Record the Application (client) ID (for example, `4369008b-21fa-427c-abaa-9b53bf58e538`).
73
+
74
+
In **Authentication** > **Platform configurations** > **Single-page application (SPA)**:
75
+
76
+
1. Confirm the **Redirect URI** of `https://localhost:{PORT}/authentication/login-callback` is present.
77
+
1. For **Implicit grant**, ensure that the check boxes for **Access tokens** and **ID tokens** are **not** selected.
78
+
1. The remaining defaults for the app are acceptable for this experience.
79
+
1. Select the **Save** button.
80
+
81
+
::: moniker-end
82
+
83
+
::: moniker range="< aspnetcore-5.0"
84
+
85
+
1. In **Azure Active Directory** > **App registrations**, select **New registration**.
86
+
1. Provide a **Name** for the app (for example, **Blazor Client AAD B2C**).
87
+
1. For **Supported account types**, select the multi-tenant option: **Accounts in any organizational directory or any identity provider. For authenticating users with Azure AD B2C.**
88
+
1. Leave the **Redirect URI** drop down set to **Web** and provide the following redirect URI: `https://localhost:{PORT}/authentication/login-callback`. The default port for an app running on Kestrel is 5001. If the app is run on a different Kestrel port, use the app's port. For IIS Express, the randomly generated port for the app can be found in the *`Server`* app's properties in the **Debug** panel. Since the app doesn't exist at this point and the IIS Express port isn't known, return to this step after the app is created and update the redirect URI. A remark appears in the [Create the app](#create-the-app) section to remind IIS Express users to update the redirect URI.
89
+
1. Confirm that **Permissions** > **Grant admin consent to openid and offline_access permissions** is selected.
68
90
1. Select **Register**.
69
91
70
92
Record the Application (client) ID (for example, `4369008b-21fa-427c-abaa-9b53bf58e538`).
|`{CLIENT APP CLIENT ID}`| Application (client) ID for the *Client app*|`4369008b-21fa-427c-abaa-9b53bf58e538`|
132
+
|`{CLIENT APP CLIENT ID}`| Application (client) ID for the *`Client`* app |`4369008b-21fa-427c-abaa-9b53bf58e538`|
109
133
|`{DEFAULT SCOPE}`| Scope name |`API.Access`|
110
134
|`{SERVER API APP CLIENT ID}`| Application (client) ID for the *Server API app*|`41451fa7-82d9-4673-8fa5-69eff5a761fd`|
111
135
|`{SERVER API APP ID URI}`| Application ID URI ([see note](#access-token-scopes)) |`41451fa7-82d9-4673-8fa5-69eff5a761fd`|
@@ -117,16 +141,22 @@ The output location specified with the `-o|--output` option creates a project fo
117
141
> [!NOTE]
118
142
> Pass the App ID URI to the `app-id-uri` option, but note a configuration change might be required in the client app, which is described in the [Access token scopes](#access-token-scopes) section.
119
143
>
120
-
> Additionally, the scope set up by the Hosted Blazor template might have the App ID URI host repeated. Confirm that the scope configured for the `DefaultAccessTokenScopes` collection is correct in `Program.Main` (`Program.cs`) of the *Client app*.
144
+
> Additionally, the scope set up by the Hosted Blazor template might have the App ID URI host repeated. Confirm that the scope configured for the `DefaultAccessTokenScopes` collection is correct in `Program.Main` (`Program.cs`) of the *`Client`* app.
> In the Azure portal, the *Client app's***Authentication** > **Platform configurations** > **Web** >**Redirect URI** is configured for port 5001 for apps that run on the Kestrel server with default settings.
153
+
> In the Azure portal, the *`Client`* app's platform configuration**Redirect URI** is configured for port 5001 for apps that run on the Kestrel server with default settings.
124
154
>
125
-
> If the *Client app* is run on a random IIS Express port, the port for the app can be found in the *Server API app's* properties in the **Debug** panel.
155
+
> If the *`Client`* app is run on a random IIS Express port, the port for the app can be found in the *Server API app's* properties in the **Debug** panel.
126
156
>
127
-
> If the port wasn't configured earlier with the *Client app's* known port, return to the *Client app's* registration in the Azure portal and update the redirect URI with the correct port.
157
+
> If the port wasn't configured earlier with the *`Client`* app's known port, return to the *`Client`* app's registration in the Azure portal and update the redirect URI with the correct port.
128
158
129
-
## Server app configuration
159
+
## *`Server`* app configuration
130
160
131
161
*This section pertains to the solution's **`Server`** app.*
132
162
@@ -227,7 +257,7 @@ public class WeatherForecastController : ControllerBase
227
257
}
228
258
```
229
259
230
-
## Client app configuration
260
+
## *`Client`* app configuration
231
261
232
262
*This section pertains to the solution's **`Client`** app.*
0 commit comments