MindAttic/MindAttic.Authentication
Library

MindAttic.Authentication.

Hardened sign-in for ASP.NET Core, in one package.

MindAttic.Authentication is a Razor Class Library that gives an ASP.NET Core app Argon2id passwords, TOTP two-step sign-in, secure reset, organizations, invitations and an audit trail, built to OWASP ASVS L2 and NIST SP 800-63B AAL2.

Stable features, proving them C# .NET 10 ASP.NET Core Blazor Razor Class Library EF Core Argon2id MailKit

What it is

Stop hand-rolling login

Every web app needs sign-in, and every hand-rolled one gets something wrong: a fast hash, a reset link that never expires, a login page that tells an attacker which emails exist. MindAttic.Authentication is one engine that gets those details right once, so each app references a package instead of reinventing security.

It was designed adversarially. Seven independent attack lenses (crypto, sessions, lockout and enumeration, MFA, secrets, policy and recovery, Blazor and packaging) fed one specification, which then went through a red-team pass. The threat model assumes a skilled attacker today and a full database breach tomorrow.

Wiring it in takes three calls in Program.cs, one interface on your own DbContext, and components like <MaLogin> and <MaMfaChallenge> dropped into your pages. Your app keeps its database, its connection and its branding; the library owns an isolated auth schema and the endpoints that actually sign people in.

It fails closed. A missing secret or a production app without a Data Protection key ring stops startup instead of running insecurely.

Who it's for

  • ASP.NET Core and Blazor developersGet login, two-step sign-in, reset and session control without writing or auditing your own.
  • Teams running several appsOne hardened sign-in shared across apps, each kept as its own trust boundary so a cookie from one never opens another.
  • Multi-customer productsOpt-in organizations, memberships, app-defined roles and email invitations, with an audit row for every change.
  • Anyone answering a security reviewA control-by-control OWASP and NIST mapping and a residual-risk register ship in the repo.

Features

What you get

01

Breach-resistant passwords

Argon2id (64 MiB, 3 passes, 4 lanes) over a peppered HMAC-SHA256, stored as self-describing PHC strings. The pepper rotates by key id, so a stolen table alone is not enough to crack anything.

02

Silent upgrades

Legacy bcrypt and SHA-256 hashes verify once with their original algorithm, then re-hash to Argon2id on the next sign-in.

03

Nothing to enumerate

Login, MFA and reset answer with the same content and timing whether or not an account exists, backed by a decoy hash and a timing floor.

04

Throttling that survives restarts

Exponential backoff per account and per IP lives in the database, so it holds across restarts and every instance shares it.

05

Two-step sign-in

TOTP (RFC 6238) with replay protection, verify-before-enable enrollment and single-use hashed recovery codes. The Admin role, and any role you list, is forced through enrollment.

06

Sessions you can revoke

A __Host- cookie with 8-hour absolute and 30-minute idle limits, a security stamp rechecked every minute on HTTP and Blazor circuits, and per-session or global sign-out.

07

Modern password rules

At least 12 characters, any Unicode, no composition rules, no forced rotation, a k-anonymity breach check and password history. Reset tokens are single-use, hashed and expire within 15 minutes.

08

Security alerts by email

Password changed or reset, two-step turned on, recovery code used, repeated failures, new device, email changed and account deactivated. Alerts never carry a password, token, code or raw IP.

09

Organizations and invitations

Opt-in memberships with app-defined roles, owner protection, an ma:org claim per membership, and single-use expiring email invitations with resend, revoke and bulk CSV.

How it works

Four steps into your app

  1. Reference the package

    Add MindAttic.Authentication, pinned to an exact whole-number version.

  2. Register and order it

    AddMindAtticAuthentication<AppDbContext>(...), UseMindAtticAuthentication() and MapMindAtticAuthEndpoints() in Program.cs.

  3. Own the data

    Implement IAuthDataContext on your DbContext, call ApplyMindAtticAuthConfiguration() and run your own migration.

  4. Drop in the pages

    Place <MaLogin>, <MaMfaChallenge> and <MaLogout> in your markup and supply the secrets under MindAttic:Vault:Security.

Quick start

Wire it up

The package targets .NET 10. Production must supply a Data Protection key ring or startup refuses to continue.

The full setup guide lives in the documentation.

csharp
builder.Services.AddMindAtticAuthentication<AppDbContext>(builder.Configuration, o =>
{
    o.AppName = "MyApp";                     // per-app trust boundary
    o.IsProduction = builder.Environment.IsProduction();
    o.ConfigureDataProtection = dp => { /* your key ring: required in production */ };
});

var app = builder.Build();

app.UseForwardedHeaders();
app.UseMindAtticAuthentication();
app.MapMindAtticAuthEndpoints(group => group.RequireRateLimiting("auth"));

Part of MindAttic

One piece of a bigger workshop

Authentication is the shared sign-in for MindAttic's web apps, among them Gadfly, IdeaCms, IdiotProof, Prose and Tutor. Each references the package and keeps its own database and branding.

Its secrets and its SMTP settings come through IConfiguration in the MindAttic.Vault schema, so a key set once in Vault reaches the sign-in of every app.

Status

Where it stands

Stable features, proving them

Version 9.0.0 is feature-complete; the work now is proof

MFA, reset, organizations and email invitations are built, and November 2026 hardened the MFA throttle, TOTP replay handling and options validation. The milestone closes the remaining test gaps on MFA enrollment, password change, revalidation and the HTTP endpoints, adds one invitation hook a consumer needs, and brings the docs up to date.

Current milestone: Authentication proven and stable: every security-critical path under failure-case tests, and docs with no 'partial' row left.

Next step

Give your app a sign-in you can trust

Guides, reference and design notes are in the searchable MindAttic documentation. The source, issues and history are on GitHub.