You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# .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
41
41
1. Open the solution in Visual Studio (2022 or later) or VS Code with the .NET MAUI extension installed.
42
42
1. Set the `MauiBlazorWeb` MAUI project as the startup project. In Visual Studio, right-click the project and select **Set as Startup Project**.
43
43
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.
45
45
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.
46
46
1. Start (`F5`) the `MauiBlazorWeb` MAUI project. You can set the debug target to either **Windows** or an Android emulator.
47
47
1. Notice you can only see the `Home` and `Login` pages.
@@ -77,7 +77,7 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
77
77
78
78
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>.
79
79
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).
81
81
82
82
A secure weather forecast data endpoint is in the project's `Program` file:
83
83
@@ -289,7 +289,7 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
289
289
290
290
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>.
291
291
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).
293
293
294
294
A secure weather forecast data endpoint is in the project's `Program` file:
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>.
563
563
564
-
:::moniker range=">= aspnetcore-9.0"
565
-
566
564
## Only serialize the name and role claims
567
565
568
566
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`.
569
567
570
-
:::moniker-end
571
-
572
568
## Supply configuration with the JSON configuration provider (app settings)
573
569
574
570
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.
@@ -116,8 +116,18 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
116
116
117
117
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>.
118
118
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
+
119
127
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>.
120
128
129
+
:::moniker-end
130
+
121
131
The project creates a [Minimal API](xref:fundamentals/minimal-apis) endpoint for weather data:
122
132
123
133
```csharp
@@ -453,8 +463,18 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
453
463
454
464
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>.
455
465
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
+
456
474
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>.
457
475
476
+
:::moniker-end
477
+
458
478
The project creates a [Minimal API](xref:fundamentals/minimal-apis) endpoint for weather data:
459
479
460
480
```csharp
@@ -848,8 +868,18 @@ The `MinimalApiJwt` project is a backend web API for multiple frontend projects.
848
868
849
869
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>.
850
870
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
+
851
879
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>.
852
880
881
+
:::moniker-end
882
+
853
883
A secure weather forecast data endpoint is in the project's `Program` file:
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
+
153
161
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>.
154
162
163
+
:::moniker-end
164
+
155
165
User role claims are sent from a [Minimal API](xref:fundamentals/minimal-apis/overview) at the `/roles` endpoint.
156
166
157
167
Routes are mapped for Identity endpoints by calling `MapIdentityApi<AppUser>()`.
0 commit comments