Skip to content

Commit b63c08c

Browse files
authored
Blazor WASM security topic updates (#18399)
1 parent a2eb937 commit b63c08c

5 files changed

Lines changed: 40 additions & 5 deletions

aspnetcore/security/blazor/webassembly/hosted-with-azure-active-directory-b2c.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Follow the guidance in [Tutorial: Register an application in Azure Active Direct
6565
1. In **Azure Active Directory** > **App registrations**, select **New registration**.
6666
1. Provide a **Name** for the app (for example, **Blazor Client AAD B2C**).
6767
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.**
68-
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. For IIS Express, the randomly generated port can be found in the Server app's properties in the **Debug** panel.
68+
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.
6969
1. Confirm that **Permissions** > **Grant admin concent to openid and offline_access permissions** is enabled.
7070
1. Select **Register**.
7171

@@ -110,6 +110,13 @@ To specify the output location, which creates a project folder if it doesn't exi
110110
>
111111
> 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*.
112112
113+
> [!NOTE]
114+
> 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.
115+
>
116+
> If the *Client app* is run on a random IIS Express port, the port for the app can be found in the *Server app's* properties in the **Debug** panel.
117+
>
118+
> 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.
119+
113120
## Server app configuration
114121

115122
*This section pertains to the solution's **Server** app.*

aspnetcore/security/blazor/webassembly/hosted-with-azure-active-directory.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Follow the guidance in [Quickstart: Register an application with the Microsoft i
6262
1. In **Azure Active Directory** > **App registrations**, select **New registration**.
6363
1. Provide a **Name** for the app (for example, **Blazor Client AAD**).
6464
1. Choose a **Supported account types**. You may select **Accounts in this organizational directory only** (single tenant) for this experience.
65-
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. For IIS Express, the randomly generated port can be found in the Server app's properties in the **Debug** panel.
65+
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.
6666
1. Disable the **Permissions** > **Grant admin concent to openid and offline_access permissions** check box.
6767
1. Select **Register**.
6868

@@ -98,6 +98,13 @@ To specify the output location, which creates a project folder if it doesn't exi
9898
> [!NOTE]
9999
> 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.
100100
101+
> [!NOTE]
102+
> 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.
103+
>
104+
> If the *Client app* is run on a random IIS Express port, the port for the app can be found in the *Server app's* properties in the **Debug** panel.
105+
>
106+
> 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.
107+
101108
## Server app configuration
102109

103110
*This section pertains to the solution's **Server** app.*

aspnetcore/security/blazor/webassembly/standalone-with-azure-active-directory-b2c.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Follow the guidance in [Tutorial: Register an application in Azure Active Direct
2929
1. In **Azure Active Directory** > **App registrations**, select **New registration**.
3030
1. Provide a **Name** for the app (for example, **Blazor Standalone AAD B2C**).
3131
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.**
32-
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. For IIS Express, the randomly generated port can be found in the app's properties in the **Debug** panel.
32+
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 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 later in this topic to remind IIS Express users to update the redirect URI.
3333
1. Confirm that **Permissions** > **Grant admin concent to openid and offline_access permissions** is enabled.
3434
1. Select **Register**.
3535

@@ -58,6 +58,13 @@ dotnet new blazorwasm -au IndividualB2C --aad-b2c-instance "{AAD B2C INSTANCE}"
5858

5959
To specify the output location, which creates a project folder if it doesn't exist, include the output option in the command with a path (for example, `-o BlazorSample`). The folder name also becomes part of the project's name.
6060

61+
> [!NOTE]
62+
> In the Azure portal, the app's **Authentication** > **Platform configurations** > **Web** > **Redirect URI** is configured for port 5001 for apps that run on the Kestrel server with default settings.
63+
>
64+
> If the app is run on a random IIS Express port, the port for the app can be found in the app's properties in the **Debug** panel.
65+
>
66+
> If the port wasn't configured earlier with the app's known port, return to the app's registration in the Azure portal and update the redirect URI with the correct port.
67+
6168
After creating the app, you should be able to:
6269

6370
* Log into the app using an AAD user account.

aspnetcore/security/blazor/webassembly/standalone-with-azure-active-directory.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Register a AAD app in the **Azure Active Directory** > **App registrations** are
2121

2222
1. Provide a **Name** for the app (for example, **Blazor Standalone AAD**).
2323
1. Choose a **Supported account types**. You may select **Accounts in this organizational directory only** for this experience.
24-
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. For IIS Express, the randomly generated port can be found in the app's properties in the **Debug** panel.
24+
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 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 later in this topic to remind IIS Express users to update the redirect URI.
2525
1. Disable the **Permissions** > **Grant admin concent to openid and offline_access permissions** check box.
2626
1. Select **Register**.
2727

@@ -45,6 +45,13 @@ dotnet new blazorwasm -au SingleOrg --client-id "{CLIENT ID}" --tenant-id "{TENA
4545

4646
To specify the output location, which creates a project folder if it doesn't exist, include the output option in the command with a path (for example, `-o BlazorSample`). The folder name also becomes part of the project's name.
4747

48+
> [!NOTE]
49+
> In the Azure portal, the app's **Authentication** > **Platform configurations** > **Web** > **Redirect URI** is configured for port 5001 for apps that run on the Kestrel server with default settings.
50+
>
51+
> If the app is run on a random IIS Express port, the port for the app can be found in the app's properties in the **Debug** panel.
52+
>
53+
> If the port wasn't configured earlier with the app's known port, return to the app's registration in the Azure portal and update the redirect URI with the correct port.
54+
4855
After creating the app, you should be able to:
4956

5057
* Log into the app using an AAD user account.

aspnetcore/security/blazor/webassembly/standalone-with-microsoft-accounts.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Register a AAD app in the **Azure Active Directory** > **App registrations** are
2121

2222
1. Provide a **Name** for the app (for example, **Blazor Standalone AAD Microsoft Accounts**).
2323
1. In **Supported account types**, select **Accounts in any organizational directory**.
24-
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. For IIS Express, the randomly generated port can be found in the app's properties in the **Debug** panel.
24+
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 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 later in this topic to remind IIS Express users to update the redirect URI.
2525
1. Disable the **Permissions** > **Grant admin concent to openid and offline_access permissions** check box.
2626
1. Select **Register**.
2727

@@ -42,6 +42,13 @@ dotnet new blazorwasm -au SingleOrg --client-id "{CLIENT ID}" --tenant-id "commo
4242

4343
To specify the output location, which creates a project folder if it doesn't exist, include the output option in the command with a path (for example, `-o BlazorSample`). The folder name also becomes part of the project's name.
4444

45+
> [!NOTE]
46+
> In the Azure portal, the app's **Authentication** > **Platform configurations** > **Web** > **Redirect URI** is configured for port 5001 for apps that run on the Kestrel server with default settings.
47+
>
48+
> If the app is run on a random IIS Express port, the port for the app can be found in the app's properties in the **Debug** panel.
49+
>
50+
> If the port wasn't configured earlier with the app's known port, return to the app's registration in the Azure portal and update the redirect URI with the correct port.
51+
4552
After creating the app, you should be able to:
4653

4754
* Log into the app using a Microsoft account.

0 commit comments

Comments
 (0)