From 946c4bd0b45ab321325bfaaa3bae4b6f54057901 Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Thu, 13 Aug 2020 05:40:32 -0500 Subject: [PATCH] Blazor WASM security MSAL login mode (#19492) --- .../hosted-with-azure-active-directory-b2c.md | 7 +++++++ .../webassembly/hosted-with-azure-active-directory.md | 7 +++++++ .../standalone-with-azure-active-directory-b2c.md | 8 ++++++++ .../standalone-with-azure-active-directory.md | 8 ++++++++ .../webassembly/standalone-with-microsoft-accounts.md | 8 ++++++++ .../includes/blazor-security/msal-login-mode.md | 11 +++++++++++ 6 files changed, 49 insertions(+) create mode 100644 aspnetcore/includes/blazor-security/msal-login-mode.md diff --git a/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md b/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md index 2461ba9a6a..205d5d8ca8 100644 --- a/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md +++ b/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md @@ -321,6 +321,13 @@ For more information, see the following sections of the *Additional scenarios* a * [Request additional access tokens](xref:blazor/security/webassembly/additional-scenarios#request-additional-access-tokens) * [Attach tokens to outgoing requests](xref:blazor/security/webassembly/additional-scenarios#attach-tokens-to-outgoing-requests) +::: moniker range=">= aspnetcore-5.0" + +### Login mode + +[!INCLUDE[](~/includes/blazor-security/msal-login-mode.md)] + +::: moniker-end ### Imports file diff --git a/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory.md b/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory.md index 5ac70fdaf1..c9d6cf8a14 100644 --- a/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory.md +++ b/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory.md @@ -312,6 +312,13 @@ For more information, see the following sections of the *Additional scenarios* a * [Request additional access tokens](xref:blazor/security/webassembly/additional-scenarios#request-additional-access-tokens) * [Attach tokens to outgoing requests](xref:blazor/security/webassembly/additional-scenarios#attach-tokens-to-outgoing-requests) +::: moniker range=">= aspnetcore-5.0" + +### Login mode + +[!INCLUDE[](~/includes/blazor-security/msal-login-mode.md)] + +::: moniker-end ### Imports file diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md b/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md index 01980f9cbe..39cd7b7f9f 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md @@ -151,6 +151,14 @@ For more information, see the following sections of the *Additional scenarios* a * [Request additional access tokens](xref:blazor/security/webassembly/additional-scenarios#request-additional-access-tokens) * [Attach tokens to outgoing requests](xref:blazor/security/webassembly/additional-scenarios#attach-tokens-to-outgoing-requests) +::: moniker range=">= aspnetcore-5.0" + +## Login mode + +[!INCLUDE[](~/includes/blazor-security/msal-login-mode.md)] + +::: moniker-end + ## Imports file [!INCLUDE[](~/includes/blazor-security/imports-file-standalone.md)] diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory.md b/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory.md index 893aa59654..36b2992cae 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory.md @@ -136,6 +136,14 @@ For more information, see the following sections of the *Additional scenarios* a * [Request additional access tokens](xref:blazor/security/webassembly/additional-scenarios#request-additional-access-tokens) * [Attach tokens to outgoing requests](xref:blazor/security/webassembly/additional-scenarios#attach-tokens-to-outgoing-requests) +::: moniker range=">= aspnetcore-5.0" + +## Login mode + +[!INCLUDE[](~/includes/blazor-security/msal-login-mode.md)] + +::: moniker-end + ## Imports file [!INCLUDE[](~/includes/blazor-security/imports-file-standalone.md)] diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md b/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md index 50835e1b3d..12200db2a3 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md @@ -132,6 +132,14 @@ For more information, see the following sections of the *Additional scenarios* a * [Request additional access tokens](xref:blazor/security/webassembly/additional-scenarios#request-additional-access-tokens) * [Attach tokens to outgoing requests](xref:blazor/security/webassembly/additional-scenarios#attach-tokens-to-outgoing-requests) +::: moniker range=">= aspnetcore-5.0" + +## Login mode + +[!INCLUDE[](~/includes/blazor-security/msal-login-mode.md)] + +::: moniker-end + ## Imports file [!INCLUDE[](~/includes/blazor-security/imports-file-standalone.md)] diff --git a/aspnetcore/includes/blazor-security/msal-login-mode.md b/aspnetcore/includes/blazor-security/msal-login-mode.md new file mode 100644 index 0000000000..f8e9ec0663 --- /dev/null +++ b/aspnetcore/includes/blazor-security/msal-login-mode.md @@ -0,0 +1,11 @@ +The framework defaults to pop-up login mode and falls back to redirect login mode if a pop-up can't be opened. Configure MSAL to use redirect login mode by setting the `LoginMode` property of to `redirect`: + +```csharp +builder.Services.AddMsalAuthentication(options => +{ + ... + options.ProviderOptions.LoginMode = "redirect"; +}); +``` + +The default setting is `popup`, and the string value isn't case sensitive.