Add hosted Blazor WASM Server package updates (#20484)

pull/20489/head
Luke Latham 2020-11-10 16:19:25 -06:00 committed by GitHub
parent 7415a422c0
commit ed296e86cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 45 additions and 3 deletions

View File

@ -101,7 +101,9 @@ For a standalone Blazor WebAssembly app registered in the Azure portal to use Az
options.ProviderOptions.DefaultAccessTokenScopes.Add("offline_access");
```
* The platform configuration is set to **Single-page application (SPA)** in the Azure portal with the app's redirect URI.
* In the Azure portal app registration **Authentication** blade, set the platform configuration to **Single-page application** with the app's redirect URI.
* Also in the **Authentication** blade, disable **Implicit grant** for **Access tokens** and **ID tokens**.
For more information, see <xref:blazor/security/webassembly/standalone-with-microsoft-accounts>.
@ -116,7 +118,9 @@ For a standalone Blazor WebAssembly app registered in the Azure portal to use Az
.Add("https://graph.microsoft.com/User.Read");
```
* The platform configuration is set to **Single-page application (SPA)** in the Azure portal with the app's redirect URI.
* In the Azure portal app registration **Authentication** blade, set the platform configuration to **Single-page application** with the app's redirect URI.
* Also in the **Authentication** blade, disable **Implicit grant** for **Access tokens** and **ID tokens**.
For more information, see <xref:blazor/security/webassembly/standalone-with-azure-active-directory>.
@ -131,14 +135,52 @@ For a standalone Blazor WebAssembly app registered in the Azure portal to use Az
options.ProviderOptions.DefaultAccessTokenScopes.Add("offline_access");
```
* The platform configuration is set to **Single-page application (SPA)** in the Azure portal with the app's redirect URI.
* In the Azure portal app registration **Authentication** blade, set the platform configuration to **Single-page application** with the app's redirect URI.
* Also in the **Authentication** blade, disable **Implicit grant** for **Access tokens** and **ID tokens**.
For more information, see <xref:blazor/security/webassembly/standalone-with-azure-active-directory-b2c>.
### Hosted Blazor WebAssembly app with Azure Active Directory (AAD) or B2C
The *`Client`* app registration of a hosted Blazor solution that uses AAD or AAD B2C for user authentication should use a **Single-page application** Azure Apps platform configuration:
1. In the Azure portal app registration for the *`Client`* app, remove the **Web** platform configuration.
1. Add a **Single-page application** platform configuration with the app's redirect URI.
1. Disable **Implicit grant** for **Access tokens** and **ID tokens**.
For more information, see:
* <xref:blazor/security/webassembly/hosted-with-azure-active-directory>
* <xref:blazor/security/webassembly/hosted-with-azure-active-directory-b2c>
### Update the Server project of a hosted Blazor solution
Update the *`Server`* project of a hosted Blazor solution as an ASP.NET Core app following the general guidance in this article.
Additionally, *`Server`* projects that authenticate users to client Blazor WebAssembly apps with Azure Active Directory (AAD) or B2C should adopt new Microsoft Identity v2.0 packages:
For AAD:
```diff
-<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="..." />
+<PackageReference Include="Microsoft.Identity.Web" Version="1.2.0" />
+<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.2.0" />
```
For AAD B2C:
```diff
-<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="..." />
+<PackageReference Include="Microsoft.Identity.Web" Version="1.2.0" />
+<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.2.0" />
```
For more information, see:
* <xref:blazor/security/webassembly/hosted-with-azure-active-directory>
* <xref:blazor/security/webassembly/hosted-with-azure-active-directory-b2c>
### Unauthorized client for Azure Active Directory (AAD)
After upgrading a Blazor WebAssembly app that uses AAD for authentication, you may receive the following error on the login callback to the app after the user signs in with AAD: