322
CHAPTER 8 | Make secure .NET Microservices and Web Applications
builder.
Services
.
AddDefaultIdentity
(options =>
options.
SignIn
.
RequireConfirmedAccount
=
true
)
.
AddEntityFrameworkStores
();
builder.
Services
.
AddRazorPages
();
//...
Once ASP.NET Core Identity is configured, you enable it by adding the
app.UseAuthentication()
and
endpoints.MapRazorPages()
as shown in the following code in the service’s
Program.cs
file:
//...
app.
UseRouting
();
app.
UseAuthentication
();
app.
UseAuthorization
();
app.
UseEndpoints
(endpoints =>
{
endpoints.
MapRazorPages
();
});
//...
Dostları ilə paylaş: