EmailAuthenticator 0.9.0

Suggested Alternatives

AccountAuthenticator

Additional Details

This package is currently no longer maintained. I may revive it in another namespace in the future.

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package EmailAuthenticator --version 0.9.0
                    
NuGet\Install-Package EmailAuthenticator -Version 0.9.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EmailAuthenticator" Version="0.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EmailAuthenticator" Version="0.9.0" />
                    
Directory.Packages.props
<PackageReference Include="EmailAuthenticator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EmailAuthenticator --version 0.9.0
                    
#r "nuget: EmailAuthenticator, 0.9.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EmailAuthenticator@0.9.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EmailAuthenticator&version=0.9.0
                    
Install as a Cake Addin
#tool nuget:?package=EmailAuthenticator&version=0.9.0
                    
Install as a Cake Tool

EmailAuthenticator

This authenticator provides a few interfaces, an AuthService, and an IdentityMiddleware. You need to implement an EmailService that actually sends the email.

Recommended API layout in Program.cs:

builder.Services.AddSingleton<AuthService>();
builder.Services.AddSingleton<IIDMiddlewareConfig, IDMiddlewareConfig>();
builder.Services.AddSingleton<IEmailService, EmailService>();

var app = builder.Build();

app.UseMiddleware<IdentityMiddleware>();

Important headers:

Email-Auth-Email: {{email}}
Email-Auth-ApiKey: {{key}}

SQL

This SQL is a requirement for the Service to work properly. Since I'm using Dapper, you need a Postgres database with the following SQL tables:

CREATE TABLE "HowlDev.User" (
  email varchar(200) UNIQUE PRIMARY KEY NOT NULL, 
  displayName varchar(80) NOT NULL,
  role int4 NOT NULL
);

CREATE TABLE "HowlDev.Key" (
  id int4 PRIMARY KEY GENERATED ALWAYS AS IDENTITY NOT NULL,
  email varchar(200) references "HowlDev.User" (email) NOT NULL, 
  apiKey varchar(20) NOT NULL,
  validatorToken varchar(40) NOT NULL,
  validatedOn timestamp NULL
);

This can be added to as much as you like to encode more information (for example in the User table), but this is what's required to make my auth work.

Upcoming Features

A few more features are coming before I consider the library done.

  • Method that gets rid of all lines in the Key table that are over time (opt-in, for your use)
  • Integration tests with the Docker Compose to run full auth flows

Changelog

0.9 (4/30/25)

  • BREAKING CHANGE: Authentication Headers have had their (_) replaced with (-), inline with the official documentation for HTML. This was messing with one of our Kubernetes assignments, after which I looked at the documentation and found this. I'm sorry, I won't make this mistake again.
  • Actually gave the expected SQL layout for the middleware/service to work properly. Sorry!

0.8.6 (4/10/25)

  • Forgot to add nullability check. ExpirationDate now works correctly.

0.8.5 (4/10/25)

  • BREAKING CHANGE: IIDMiddlewareConfig has an additional value, ReValidationDate (nullable), to reset the valid timer for that key.
  • Expiration Date in IIDMiddlewareConfig is now nullable

0.8 (3/31/25)

  • Init
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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