Micro Multi Tenanted Value Resolver Library
I've recently been adding multi-tenancy to a full-stack application with an ASP.NET Core back end. The multi-tenant libraries I looked at had one or more of these problems:
- Complex APIs that needed a lot of documentation reading
- Hard to plug in different ways of resolving values
- Lots of boilerplate code and services to implement
Many of them also load credentials from configuration files or a resolution database. I don't like that. Why?
Most credentials don't belong in files like
appsettings.json. They belong in a key vault, such as Azure Key
Vault, which brings permission management, hardware-level encryption
and more.
So I wrote a very, very small library. It's middleware that resolves
the tenant for each request and pushes that tenant's credentials into
the current HttpContext. It's available as a NuGet
package.
A nice thing about Azure Key Vault is that all secrets, subject to
access rights, can be loaded into IConfiguration when the
application builds.
The source and more information are on GitHub.