diff --git a/aspnetcore/blazor/hybrid/security/index.md b/aspnetcore/blazor/hybrid/security/index.md index 35d48eaae90e..b1fac1fd45f1 100644 --- a/aspnetcore/blazor/hybrid/security/index.md +++ b/aspnetcore/blazor/hybrid/security/index.md @@ -5,61 +5,534 @@ description: Learn about Blazor Hybrid authentication and authorization scenario monikerRange: '>= aspnetcore-6.0' ms.author: riande ms.custom: mvc -ms.date: 04/19/2022 +ms.date: 05/23/2022 no-loc: [".NET MAUI", "Mac Catalyst", "Blazor Hybrid", Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR] uid: blazor/hybrid/security/index +zone_pivot_groups: blazor-hybrid-frameworks --- # ASP.NET Core Blazor Hybrid authentication and authorization -This article describes ASP.NET Core's support for the configuration and management of security in Blazor Hybrid apps. +This article describes ASP.NET Core's support for the configuration and management of security and ASP.NET Core Identity in Blazor Hybrid apps. [!INCLUDE[](~/blazor/includes/blazor-hybrid-preview-notice.md)] -## Untrusted and unencoded content +Authentication in Blazor Hybrid apps is handled by native platform libraries, as they offer enhanced security guarantees that the browser sandbox can't offer. Authentication of native apps uses an OS-specific mechanism or via a federated protocol, such as [OpenID Connect (OIDC)](https://openid.net/connect/). Follow the guidance for the identity provider that you've selected for the app and then further integrate identity with Blazor using the guidance in this article. -Avoid allowing an app render untrusted and unencoded content from a database or other resource, such as user-provided comments, in its rendered UI. Permitting untrusted, unencoded content to render can cause malicious code to execute. +Integrating authentication must achieve the following goals for Razor components and services: -## External content rendered in an `iframe` +* Use the abstractions in the [`Microsoft.AspNetCore.Components.Authorization`](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.Authorization) package, such as . +* React to changes in the authentication context. +* Access credentials provisioned by the app from the identity provider, such as access tokens to perform authorized API calls. -When using an [`iframe`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe) to display external content within a Blazor Hybrid page, we recommend that users leverage sandboxing features to ensure that the content is isolated from the parent page containing the app. In the following example, the [`sandbox` attribute](https://developer.mozilla.org/docs/Web/HTML/Element/iframe) is present for the `