Skip to content

Latest commit

 

History

History
33 lines (33 loc) · 1.43 KB

File metadata and controls

33 lines (33 loc) · 1.43 KB

BlackstarSolar.AspNetCore.Identity.PwnedPasswords

This library provides an IPasswordValidator for Microsoft ASP.NET Core Identity which validates passwords against HaveIBeenPwned.com's Pwned Passwords using the v2 RESTful API.

Usage

To use the default error message:

public class Startup
{
     public void ConfigureServices(IServiceCollection services)
     {
        services.AddIdentity<MyApplicationUser, IdentityRole>()
            .AddPwnedPasswordsValidator<MyApplicationUser>();
     }
}

To specify a custom error message for pwned password:

public class Startup
{
     public void ConfigureServices(IServiceCollection services)
     {
        services.AddIdentity<MyApplicationUser, IdentityRole>()
            .AddPwnedPasswordsValidator<MyApplicationUser>(options => options.ErrorMessage = "Custom error message");
     }
}

Nuget Package

Install-Package BlackstarSolar.AspNetCore.Identity.PwnedPasswords  

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Build Status

Build Status