Idmt.Plugin 0.1.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Idmt.Plugin --version 0.1.4
                    
NuGet\Install-Package Idmt.Plugin -Version 0.1.4
                    
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="Idmt.Plugin" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Idmt.Plugin" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Idmt.Plugin" />
                    
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 Idmt.Plugin --version 0.1.4
                    
#r "nuget: Idmt.Plugin, 0.1.4"
                    
#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 Idmt.Plugin@0.1.4
                    
#: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=Idmt.Plugin&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Idmt.Plugin&version=0.1.4
                    
Install as a Cake Tool

IDMT Plugin

Identity MultiTenant plugin library for ASP.NET Core that provides automatic identity management (authentication and authorization) and multi-tenancy support using Finbuckle.MultiTenant and Microsoft.AspNetCore.Identity.

Features

  • Multi-Tenant Support: Built-in multi-tenancy using Finbuckle.MultiTenant.
  • Identity Management: ASP.NET Core Identity integration with support for both Bearer Token (JWT) and Cookie authentication.
  • Vertical Slice Architecture: Each identity endpoint has its own handler interface and implementation.
  • Minimal APIs: Modern endpoint routing with clean, composable APIs.
  • Configurable: Extensive configuration options for identity, cookies, and multi-tenancy strategies.
  • Database Agnostic: Works with any Entity Framework Core provider.

Quick Start

1. Install the Package

dotnet add package Idmt.Plugin

2. Configure Services

In your Program.cs, add the IDMT services. You generally need to provide your own DbContext that inherits from IdmtDbContext.

using Idmt.Plugin.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add IDMT services with your custom DbContext
builder.Services.AddIdmt<MyDbContext>(
    builder.Configuration,
    // Configure your database provider (e.g., SQL Server, PostgreSQL, SQLite)
    options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))
);

var app = builder.Build();

// Configure the HTTP request pipeline
app.UseIdmt();

// Ensure database is created and seeded (optional helper)
app.EnsureIdmtDatabase();
app.SeedIdmtData();

app.Run();

3. Application Configuration

Add the Idmt section to your appsettings.json. Below is a comprehensive example with default or common values:

{
  "Idmt": {
    "Application": {
      "ClientUrl": "https://myapp.com",
      "ResetPasswordFormPath": "/reset-password",
      "ConfirmEmailFormPath": "/confirm-email"
    },
    "Identity": {
      "Password": {
        "RequireDigit": true,
        "RequireLowercase": true,
        "RequireUppercase": true,
        "RequireNonAlphanumeric": false,
        "RequiredLength": 6
      },
      "User": {
        "RequireUniqueEmail": true
      },
      "SignIn": {
        "RequireConfirmedEmail": false
      },
      "Cookie": {
        "Name": ".Idmt.Application",
        "HttpOnly": true,
        "SameSite": "Lax",
        "ExpireTimeSpan": "14.00:00:00",
        "SlidingExpiration": true
      }
    },
    "MultiTenant": {
      "DefaultTenantId": "system-tenant",
      "Strategies": ["header", "route", "claim"],
      "StrategyOptions": {
        "HeaderName": "__tenant__",
        "RouteParameter": "__tenant__",
        "ClaimType": "tenant"
      }
    },
    "Database": {
      "AutoMigrate": false
    }
  }
}

API Reference

The plugin exposes several groups of endpoints.

Authentication (/auth)

Public endpoints for user authentication and account recovery.

Method Endpoint Description Query/Body Parameters
POST /auth/login Authenticate user Body: email, password<br>Query: useCookies, useSessionCookies
POST /auth/logout Logout user -
POST /auth/refresh Refresh JWT token Body: refreshToken
POST /auth/forgotPassword Request password reset Body: email<br>Query: useApiLinks (true/false)
POST /auth/resetPassword Reset password with token Query: tenantId, email, token<br>Body: newPassword
GET /auth/confirmEmail Confirm email address Query: tenantId, email, token
POST /auth/resendConfirmationEmail Resend confirmation Body: email<br>Query: useApiLinks

User Management (/auth/manage)

Endpoints for managing user profiles and accounts.

  • Authorization: Some endpoints require specific roles (SysAdmin, TenantAdmin).
Method Endpoint Policy Description
GET /auth/manage/info Authenticated Get current user's info
PUT /auth/manage/info Authenticated Update current user's info
POST /auth/manage/users RequireSysUser Register a new user (Admin only)
PUT /auth/manage/users/{id} RequireTenantManager Activate/Deactivate user
DELETE /auth/manage/users/{id} RequireTenantManager Delete a user

System & Tenant Access (/sys)

System-level endpoints for managing tenant access.

  • Authorization: RequireSysUser (SysAdmin or SysSupport roles).
Method Endpoint Description
GET /sys/info Get system version and environment info
GET /sys/users/{id}/tenants List tenants accessible by a user
POST /sys/users/{id}/tenants/{tenantId} Grant user access to a tenant
DELETE /sys/users/{id}/tenants/{tenantId} Revoke user access to a tenant

Authorization Policies

The plugin comes with pre-configured authorization policies based on roles:

  • RequireAuthenticatedUser: Any authenticated user.
  • RequireSysAdmin: Users with SysAdmin role.
  • RequireSysUser: Users with SysAdmin or SysSupport roles.
  • RequireTenantManager: Users with SysAdmin, SysSupport, or TenantAdmin roles.

Architecture

Multi-Tenancy

The library supports multiple tenant resolution strategies out of the box:

  • Header: Reads tenant ID from a request header (default __tenant__).
  • Route: Reads from a route parameter (default __tenant__).
  • Claim: Reads from the user's claims (useful for JWTs).

Authentication Strategies

The plugin uses a hybrid approach:

  • Cookie: Standard ASP.NET Core Identity cookies (great for browser apps).
  • Bearer Token: Custom implementation compatible with ASP.NET Core Identity's bearer tokens (great for SPAs and Mobile apps).

The CookieOrBearer policy automatically selects the scheme based on the Authorization header.

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
0.5.6 87 1/4/2026
0.5.5 89 1/3/2026
0.5.4 96 1/2/2026
0.5.3 83 1/2/2026
0.5.1 86 12/31/2025
0.5.0 88 12/31/2025
0.4.2 85 12/30/2025
0.4.1 89 12/27/2025
0.4.0 169 12/23/2025
0.3.0 168 12/22/2025
0.2.1 127 12/20/2025
0.2.0 270 12/18/2025
0.1.4 265 12/17/2025
0.1.3 265 12/17/2025
0.1.2 270 12/16/2025
0.1.1 272 12/15/2025
0.1.0 149 12/14/2025