Matrixsoft.PwnedPasswords 1.1.0

Install-Package Matrixsoft.PwnedPasswords -Version 1.1.0
dotnet add package Matrixsoft.PwnedPasswords --version 1.1.0
<PackageReference Include="Matrixsoft.PwnedPasswords" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Matrixsoft.PwnedPasswords --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Matrixsoft.PwnedPasswords, 1.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Matrixsoft.PwnedPasswords as a Cake Addin
#addin nuget:?package=Matrixsoft.PwnedPasswords&version=1.1.0

// Install Matrixsoft.PwnedPasswords as a Cake Tool
#tool nuget:?package=Matrixsoft.PwnedPasswords&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Pwned Passwords

This library provides a simple HttpClient instance that consumes Troy Hunt's PwnedPasswords API v3 and checks a password's integrity whether it has previously appeared in a data breach or not. It also includes ASP.NET Core Identity IPasswordValidator implementation along with an extension method to inject it using Dependency Injection principle.

Installation

In Package Manager Console (Visual Studio), select a specified project into which you want to install the package and enter the command Install-Package Matrixsoft.PwnedPasswords or use any of these methods according to your development environment.

Usage

For .NET Core app:

var client = new PwnedPasswordsClient();
var flag = await client.IsPasswordPwnedAsync(password);
if (flag)
{
    // TODO: Failed
}
else
{
    // TODO: Success
}

For ASP.NET Core Web app:

Add the password validator to ASP.NET Core Identity configuration using the IdentityBuilder extension method in Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext<ApplicationDbContext>(options =>
        options.UseSqlite(
            Configuration.GetConnectionString("DefaultConnection")));
    services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
        .AddPwnedPasswordsValidator<IdentityUser>()
        .AddEntityFrameworkStores<ApplicationDbContext>();
    services.AddControllersWithViews();
    services.AddRazorPages();

    services.AddTransient<PwnedPasswordsClient>();
}

Thanks

Problems

If you run into bugs / have feature suggestions / have questions, please file a Github bug.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 322 3/21/2020
1.0.0 670 2/28/2018