Select theme:

Material 3

Custom security password policylink

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.

Source Code

Step by steplink

1. Create new application with .NET server-side project, add new MSSQL data-source connected to Northwind database, auto-generate pages and enable security.

image

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

image

3. Run the application and register user(s). image image

In this article —
© 2016-2025 Radzen Ltd. All Rights Reserved.
Designed and developed with ❤️ in Radzen Blazor Studio.

Select theme:

Material 3