AspNetCore.Identity LockoutOptions.AllowedForNewUsers 属性

AspNetCore.Identity LockoutOptions.AllowedForNewUsers Property

我想了解 AllowedForNewUsers 属性 的用途。 documentation 声明它:

Gets or sets a flag indicating whether a new user can be locked out. Defaults to true.

但这根本没有告诉我任何用处,从表面上看,这意味着新用户可以被锁定,但这根本没有意义,因为您已经拥有标准锁定功能。

我什至检查了 Git 更改日志以了解其实施时间,但这也无济于事。

    /// Gets or sets a flag indicating whether users can be locked out after creation.
    /// </summary>
    /// <value>
    /// True if a newly created user can be locked out, otherwise false.
    /// </value>
    /// <remarks>
    /// Defaults to true.
    /// </remarks>
    public bool AllowedForNewUsers { get; set; } = true;

任何指导将不胜感激。

由于 "lock out on incorrect number of failed password attempts" 是每个用户的选择加入,LockoutOptions.AllowedForNewUsers 的值将导致在创建新用户时将 IdentityUser<TKey>.LockoutEnabled 值设置为相同。

所以如果 LockoutOptions.AllowedForNewUserstrue 那么 IdentityUser<TKey>.LockoutEnabled 也将被设置为 true 从而导致用户在 LockoutOptions.MaxFailedAccessAttempts 之后被锁定.

谢谢 Kirk Larkin for posting the link to this site 这有助于填补一堆空白。