Custom security password policy
Radzen provides security support out of the box, more info can be found in our Security article. This guide demonstrates how to extend Radzen application security with custom password policy.
Step by step
1. Create new application with .NET server-side project, add new MSSQL data-source connected to Northwind database, auto-generate pages and enable security.
By default, ASP.NET Core Identity requires that passwords contain an uppercase character, lowercase character, a digit, and a non-alphanumeric character and must be at least six characters long. You can customize this using Startup.OnConfigureServices()
2. Extend Startup.cs
OnConfigureServices
partial method desired password policy
Startup.Custom.cs
public partial class Startup
{
partial void OnConfigureServices(IServiceCollection services)
{
services.Configure<IdentityOptions>(options =>
{
options.Password.RequireDigit = false;
options.Password.RequireLowercase = false;
options.Password.RequireNonAlphanumeric = false;
options.Password.RequireUppercase = false;
options.Password.RequiredLength = 4;
options.Password.RequiredUniqueChars = 0;
});
}
}
Startup.Custom.vb
Public Partial Class Startup
Private Partial Sub OnConfigureServices(ByVal services As IServiceCollection)
services.Configure(Of IdentityOptions)(Function(options)
options.Password.RequireDigit = False
options.Password.RequireLowercase = False
options.Password.RequireNonAlphanumeric = False
options.Password.RequireUppercase = False
options.Password.RequiredLength = 4
options.Password.RequiredUniqueChars = 0
End Function)
End Sub
End Class
3. Run the application and register user(s).