Загрузка страницы

ASP NET core identity password complexity

In this video we will discuss how to configure password complexity rules in asp.net core using asp.net core IdentityOptions class.

Text version of the video
https://csharp-video-tutorials.blogspot.com/2019/06/aspnet-core-identity-password-complexity.html

Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1

Slides
https://csharp-video-tutorials.blogspot.com/2019/06/aspnet-core-identity-password.html

ASP.NET Core Text Articles & Slides
https://csharp-video-tutorials.blogspot.com/2019/01/aspnet-core-tutorial-for-beginners.html

ASP.NET Core Tutorial
https://www.youtube.com/playlist?list=PL6n9fhu94yhVkdrusLaQsfERmL_Jh4XmU

Angular, JavaScript, jQuery, Dot Net & SQL Playlists
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd
By default, asp.net core identity does not allow creating simple passwords to protect our application from automated brute-force attacks. When we try to register a new user account with a simple password like abc, the account creation fails and you will see validation errors related to password complexity.

ASP.NET Core Identity Password Default Settings

In ASP.NET Core Identity, Password Default Settings are specified in the PasswordOptions class. You can find the source code of this class on the asp.net core github repo at the following link. Simply search in the repo for the PasswordOptions class.
https://github.com/aspnet/AspNetCore

public class PasswordOptions
{
public int RequiredLength { get; set; } = 6;
public int RequiredUniqueChars { get; set; } = 1;
public bool RequireNonAlphanumeric { get; set; } = true;
public bool RequireLowercase { get; set; } = true;
public bool RequireUppercase { get; set; } = true;
public bool RequireDigit { get; set; } = true;
}

How to override password default settings in asp.net core identity

We could do this by, using the Configure() method of the IServiceCollection interface in the ConfigureServices() method of the Startup class

services.Configure[IdentityOptions](options =]
{
options.Password.RequiredLength = 10;
options.Password.RequiredUniqueChars = 3;
options.Password.RequireNonAlphanumeric = false;
});

OR

We could also do this while adding Identity services

services.AddIdentity[IdentityUser, IdentityRole](options =]
{
options.Password.RequiredLength = 10;
options.Password.RequiredUniqueChars = 3;
options.Password.RequireNonAlphanumeric = false;
})
.AddEntityFrameworkStores[AppDbContext]();

ASP.NET Core IdentityOptions

In this example, we are using the IdentityOptions object to configure PasswordOptions. We could also use this IdentityOptions object to configure
UserOptions
SignInOptions
LockoutOptions
TokenOptions
StoreOptions
ClaimsIdentityOptions

Видео ASP NET core identity password complexity канала kudvenkat
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
7 июня 2019 г. 0:06:43
00:04:49
Яндекс.Метрика