Skip to content

Commit e0e5ac3

Browse files
authored
Version Swashbuckle/Swagger remarks (#35839)
1 parent 0e17478 commit e0e5ac3

File tree

4 files changed

+47
-11
lines changed

4 files changed

+47
-11
lines changed

aspnetcore/blazor/hybrid/security/maui-blazor-web-identity.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to build a .NET MAUI Blazor Hybrid app with a Blazor Web
55
monikerRange: '>= aspnetcore-9.0'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 03/12/2025
8+
ms.date: 07/29/2025
99
uid: blazor/hybrid/security/maui-blazor-web-identity
1010
---
1111
# .NET MAUI Blazor Hybrid and Web App with ASP.NET Core Identity
@@ -41,7 +41,7 @@ The sample app is a starter solution that contains a native, cross-platform MAUI
4141
1. Open the solution in Visual Studio (2022 or later) or VS Code with the .NET MAUI extension installed.
4242
1. Set the `MauiBlazorWeb` MAUI project as the startup project. In Visual Studio, right-click the project and select **Set as Startup Project**.
4343
1. Start the `MauiBlazorWeb.Web` project without debugging. In Visual Studio, right-click on the project and select **Debug** > **Start without Debugging**.
44-
1. Inspect the Identity endpoints by navigating to `https://localhost:7157/swagger` in a browser.
44+
1. Inspect the Identity endpoints via [OpenAPI documentation](xref:fundamentals/openapi/overview). You can add a third-party OpenAPI-compliant visual UI/endpoint tester.
4545
1. Navigate to `https://localhost:7157/account/register` to register a user in the Blazor Web App. Immediately after the user is registered, use the **Click here to confirm your account** link in the UI to confirm the user's email address because a real email sender isn't registered for account confirmation.
4646
1. Start (`F5`) the `MauiBlazorWeb` MAUI project. You can set the debug target to either **Windows** or an Android emulator.
4747
1. Notice you can only see the `Home` and `Login` pages.

aspnetcore/blazor/security/blazor-web-app-with-entra.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to secure a Blazor Web App with Microsoft Entra ID.
55
monikerRange: '>= aspnetcore-9.0'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 06/11/2025
8+
ms.date: 07/29/2025
99
uid: blazor/security/blazor-web-app-entra
1010
zone_pivot_groups: blazor-web-app-entra-specification
1111
---
@@ -77,7 +77,7 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
7777

7878
The `MinimalApiJwt.http` file can be used for testing the weather data request. Note that the `MinimalApiJwt` project must be running to test the endpoint, and the endpoint is hardcoded into the file. For more information, see <xref:test/http-files>.
7979

80-
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview) and the [Swagger UI](https://swagger.io/api-hub/) in the Development environment. For more information, see <xref:fundamentals/openapi/using-openapi-documents#use-swagger-ui-for-local-ad-hoc-testing>.
80+
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview).
8181

8282
A secure weather forecast data endpoint is in the project's `Program` file:
8383

@@ -289,7 +289,7 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
289289

290290
The `MinimalApiJwt.http` file can be used for testing the weather data request. Note that the `MinimalApiJwt` project must be running to test the endpoint, and the endpoint is hardcoded into the file. For more information, see <xref:test/http-files>.
291291

292-
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview) and the [Swagger UI](https://swagger.io/api-hub/) in the Development environment. For more information, see <xref:fundamentals/openapi/using-openapi-documents#use-swagger-ui-for-local-ad-hoc-testing>.
292+
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview).
293293

294294
A secure weather forecast data endpoint is in the project's `Program` file:
295295

@@ -561,14 +561,10 @@ msIdentityOptions.ClientSecret = AzureHelper.GetKeyVaultSecret("{VAULT URI}",
561561

562562
Configuration is used to facilitate supplying dedicated key vaults and secret names based on the app's environmental configuration files. For example, you can supply different configuration values for `appsettings.Development.json` in development, `appsettings.Staging.json` when staging, and `appsettings.Production.json` for the production deployment. For more information, see <xref:blazor/fundamentals/configuration>.
563563

564-
:::moniker range=">= aspnetcore-9.0"
565-
566564
## Only serialize the name and role claims
567565

568566
In the `Program` file, all claims are serialized by setting <xref:Microsoft.AspNetCore.Components.WebAssembly.Server.AuthenticationStateSerializationOptions.SerializeAllClaims%2A> to `true`. If you only want the name and role claims serialized for CSR, remove the option or set it to `false`.
569567

570-
:::moniker-end
571-
572568
## Supply configuration with the JSON configuration provider (app settings)
573569

574570
The [sample solution projects](#sample-solution) configure Microsoft Identity Web and JWT bearer authentication in their `Program` files in order to make configuration settings discoverable using C# autocompletion. Professional apps usually use a *configuration provider* to configure OIDC options, such as the default [JSON configuration provider](xref:fundamentals/configuration/index). The JSON configuration provider loads configuration from app settings files `appsettings.json`/`appsettings.{ENVIRONMENT}.json`, where the `{ENVIRONMENT}` placeholder is the app's [runtime environment](xref:fundamentals/environments). Follow the guidance in this section to use app settings files for configuration.

aspnetcore/blazor/security/blazor-web-app-with-oidc.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to secure a Blazor Web App with OpenID Connect (OIDC).
55
monikerRange: '>= aspnetcore-8.0'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 04/29/2025
8+
ms.date: 07/29/2025
99
uid: blazor/security/blazor-web-app-oidc
1010
zone_pivot_groups: blazor-web-app-oidc-specification
1111
---
@@ -116,8 +116,18 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
116116

117117
The `MinimalApiJwt.http` file can be used for testing the weather data request. Note that the `MinimalApiJwt` project must be running to test the endpoint, and the endpoint is hardcoded into the file. For more information, see <xref:test/http-files>.
118118

119+
:::moniker range=">= aspnetcore-9.0"
120+
121+
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview).
122+
123+
:::moniker-end
124+
125+
:::moniker range="< aspnetcore-9.0"
126+
119127
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview) and the [Swagger UI](https://swagger.io/api-hub/) in the Development environment. For more information, see <xref:fundamentals/openapi/using-openapi-documents#use-swagger-ui-for-local-ad-hoc-testing>.
120128

129+
:::moniker-end
130+
121131
The project creates a [Minimal API](xref:fundamentals/minimal-apis) endpoint for weather data:
122132

123133
```csharp
@@ -453,8 +463,18 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
453463

454464
The `MinimalApiJwt.http` file can be used for testing the weather data request. Note that the `MinimalApiJwt` project must be running to test the endpoint, and the endpoint is hardcoded into the file. For more information, see <xref:test/http-files>.
455465

466+
:::moniker range=">= aspnetcore-9.0"
467+
468+
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview).
469+
470+
:::moniker-end
471+
472+
:::moniker range="< aspnetcore-9.0"
473+
456474
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview) and the [Swagger UI](https://swagger.io/api-hub/) in the Development environment. For more information, see <xref:fundamentals/openapi/using-openapi-documents#use-swagger-ui-for-local-ad-hoc-testing>.
457475

476+
:::moniker-end
477+
458478
The project creates a [Minimal API](xref:fundamentals/minimal-apis) endpoint for weather data:
459479

460480
```csharp
@@ -848,8 +868,18 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
848868

849869
The `MinimalApiJwt.http` file can be used for testing the weather data request. Note that the `MinimalApiJwt` project must be running to test the endpoint, and the endpoint is hardcoded into the file. For more information, see <xref:test/http-files>.
850870

871+
:::moniker range=">= aspnetcore-9.0"
872+
873+
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview).
874+
875+
:::moniker-end
876+
877+
:::moniker range="< aspnetcore-9.0"
878+
851879
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview) and the [Swagger UI](https://swagger.io/api-hub/) in the Development environment. For more information, see <xref:fundamentals/openapi/using-openapi-documents#use-swagger-ui-for-local-ad-hoc-testing>.
852880

881+
:::moniker-end
882+
853883
A secure weather forecast data endpoint is in the project's `Program` file:
854884

855885
```csharp

aspnetcore/blazor/security/webassembly/standalone-with-identity/index.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to secure Blazor WebAssembly apps with ASP.NET Core Ident
55
monikerRange: '>= aspnetcore-8.0'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 11/12/2024
8+
ms.date: 07/29/2025
99
uid: blazor/security/webassembly/standalone-with-identity/index
1010
---
1111
# Secure ASP.NET Core Blazor WebAssembly with ASP.NET Core Identity
@@ -150,8 +150,18 @@ A [Cross-Origin Resource Sharing (CORS)](xref:security/cors) policy is establish
150150
* `Backend` app (`BackendUrl`): `https://localhost:5001`
151151
* `BlazorWasmAuth` app (`FrontendUrl`): `https://localhost:5002`
152152

153+
:::moniker range=">= aspnetcore-9.0"
154+
155+
The project includes packages and configuration to produce [OpenAPI documents](xref:fundamentals/openapi/overview).
156+
157+
:::moniker-end
158+
159+
:::moniker range="< aspnetcore-9.0"
160+
153161
Services and endpoints for [Swagger/OpenAPI](xref:tutorials/web-api-help-pages-using-swagger) are included for web API documentation and development testing. For more information on NSwag, see <xref:tutorials/get-started-with-nswag>.
154162

163+
:::moniker-end
164+
155165
User role claims are sent from a [Minimal API](xref:fundamentals/minimal-apis/overview) at the `/roles` endpoint.
156166

157167
Routes are mapped for Identity endpoints by calling `MapIdentityApi<AppUser>()`.

0 commit comments

Comments
 (0)