Skip to content

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.

License

Notifications You must be signed in to change notification settings

thegrahamking/BlackstarSolar.AspNetCore.Identity.PwnedPasswords

Repository files navigation

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

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages