implemented/configured/declared Identity UI /Account/Manage 页面需要身份验证在哪里?

Where is implemented/configured/declared that Identity UI /Account/Manage pages require authentication?

我已将所有 Identity UI 页面搭建到我的 ASP.NET 核心(razor 页面)项目中。 /Account/Manage 页面应该仅限于授权用户,这是完美的,但是我找不到这个限制在哪里 implemented/configured/declared。

我的意思是没有 [Authorize] 属性的痕迹。我还查看了 5.0.12 和 6.0.0 的原始来源,original UI source code 也没有这样的属性

问题

此授权要求(有效且有效)在哪里实施,coded/declared?

我没有从启动代码开始跟踪整个调用堆栈:

builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
    .AddEntityFrameworkStores<ApplicationDbContext>();

但在 IdentityDefaultUIConfigureOptions 中:

https://github.com/dotnet/aspnetcore/blob/v5.0.12/src/Identity/UI/src/IdentityDefaultUIConfigureOptions.cs

有代码:

    options.Conventions.AuthorizeAreaFolder(IdentityUIDefaultAreaName, "/Account/Manage");
    options.Conventions.AuthorizeAreaPage(IdentityUIDefaultAreaName, "/Account/Logout");

它使用:https://github.com/dotnet/aspnetcore/blob/0bc3c376f0cd14335e8b3afca69596acabeb1f80/src/Mvc/Mvc.RazorPages/src/DependencyInjection/PageConventionCollectionExtensions.cs#L407

动态添加属性:

   public static PageConventionCollection AuthorizeAreaFolder(
        this PageConventionCollection conventions,
        string areaName,
        string folderPath,
        string policy)
    {
        if (conventions == null)
        {
            throw new ArgumentNullException(nameof(conventions));
        }

        if (string.IsNullOrEmpty(areaName))
        {
            throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(areaName));
        }

        if (string.IsNullOrEmpty(folderPath))
        {
            throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(folderPath));
        }

        conventions.AddAreaFolderApplicationModelConvention(areaName, folderPath, model =>
        {
            if (conventions.MvcOptions.EnableEndpointRouting)
            {
                model.EndpointMetadata.Add(new AuthorizeAttribute(policy));
            }
            else
            {
                model.Filters.Add(new AuthorizeFilter(policy));
            }
        });
        return conventions;
    }