简体   繁体   English

AspNetCore.Identity LockoutOptions.AllowedForNewUsers属性

[英]AspNetCore.Identity LockoutOptions.AllowedForNewUsers Property

I'm trying to understand what the purpose of the AllowedForNewUsers property is for. 我试图了解AllowedForNewUsers属性的用途。 The documentation states that it: 文档指出:

Gets or sets a flag indicating whether a new user can be locked out. 获取或设置一个标志,该标志指示是否可以锁定新用户。 Defaults to true. 默认为true。

But this simply doesn't tell me anything of use, at face value it means that new users can be locked out but that's simply nonsensical since you already have the standard lockout feature. 但这根本没有告诉我任何使用,从表面上看,这意味着可以锁定新用户,但这完全是荒谬的,因为您已经具有标准的锁定功能。

I've even checked the Git change log for when it was implemented but that was also of no help. 我什至检查了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;

Any guidance would be highly appreciated. 任何指导将不胜感激。

Since the "lock out on incorrect number of failed password attempts" is an opt-in per user, the value for LockoutOptions.AllowedForNewUsers will cause the IdentityUser<TKey>.LockoutEnabled value to be set the same when creating a new user. 自“锁定在密码尝试失败数不正确”是每用户一个选择,该值LockoutOptions.AllowedForNewUsers将使IdentityUser<TKey>.LockoutEnabled值创建新用户时可以设置的相同。

So if LockoutOptions.AllowedForNewUsers is true then the IdentityUser<TKey>.LockoutEnabled will also be set to true and thus cause the user to be locked out after LockoutOptions.MaxFailedAccessAttempts . 因此,如果LockoutOptions.AllowedForNewUserstrueIdentityUser<TKey>.LockoutEnabled也将设置为true ,从而使用户在LockoutOptions.MaxFailedAccessAttempts之后被锁定。

Thank you Kirk Larkin for posting the link to this site which helps fill in a bunch of the blanks. 感谢Kirk Larkin发布了指向该网站链接,该链接有助于填补空白。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AspNetCore.Identity中的Google身份验证 - Google authentication in AspNetCore.Identity 将 AddPooledDbContextFactory 与 AspNetCore.Identity 一起使用 - Using AddPooledDbContextFactory with AspNetCore.Identity 覆盖AspNetCore.Identity表中的默认索引 - Override default indexes in AspNetCore.Identity tables ViewComponent 无法识别 AspNetCore.Identity“用户” - ViewComponent does not recognize AspNetCore.Identity "User" 身份服务器 4 + AspNetCore.Identity:X 尝试后如何锁定? - identity server 4 + AspNetCore.Identity: how to lockout after X tries? AspNetCore.Identity 不适用于自定义用户/角色实现 - AspNetCore.Identity not working with custom User/Role implementation AspNetCore.Identity - 如何为新用户设置 LockoutEnabled = false - AspNetCore.Identity - How to set LockoutEnabled = false for a new user ASP.NET核心 - 自定义AspNetCore.Identity实现不起作用 - ASP.NET Core - custom AspNetCore.Identity implementation not working 如何在 AspNetCore.Identity 上删除基本字段并添加自定义字段? - How to delete basic fields and add custom fields on AspNetCore.Identity? 如何使用 AspNetCore.Identity 为多个用户获取声明? - How to get Claims for multiple users with AspNetCore.Identity?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM