SaaSFactory.TenantAuth.AzureAD.Enhanced 2.0.0

dotnet add package SaaSFactory.TenantAuth.AzureAD.Enhanced --version 2.0.0
                    
NuGet\Install-Package SaaSFactory.TenantAuth.AzureAD.Enhanced -Version 2.0.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="SaaSFactory.TenantAuth.AzureAD.Enhanced" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SaaSFactory.TenantAuth.AzureAD.Enhanced" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SaaSFactory.TenantAuth.AzureAD.Enhanced" />
                    
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 SaaSFactory.TenantAuth.AzureAD.Enhanced --version 2.0.0
                    
#r "nuget: SaaSFactory.TenantAuth.AzureAD.Enhanced, 2.0.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 SaaSFactory.TenantAuth.AzureAD.Enhanced@2.0.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=SaaSFactory.TenantAuth.AzureAD.Enhanced&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SaaSFactory.TenantAuth.AzureAD.Enhanced&version=2.0.0
                    
Install as a Cake Tool

SaaSFactory.TenantAuth.AzureAD v2.0

Production-ready, multi-tenant Azure AD authentication for ASP.NET Core (.NET 8) with enhanced features, flexible audience validation, and configurable authentication policies.

๐Ÿš€ What's New in v2.0

  • โœ… Enhanced Azure AD Integration with flexible audience validation
  • โœ… Configurable Authentication Policies (optional global authentication)
  • โœ… Improved Debugging with detailed error logging
  • โœ… Legacy Format Support for better Azure AD compatibility
  • โœ… Production Tested with real Azure AD environments
  • โœ… Backward Compatible - all v1.x functionality preserved

Quick Start

`csharp using SaaSFactory.TenantAuth.AzureAD;

var builder = WebApplication.CreateBuilder(args);

// Enhanced authentication with advanced features builder.Services.AddEnhancedSaaSFactoryAzureADAuth( builder.Configuration, enableStrictTenantValidation: true, enableGlobalAuthPolicy: false, supportLegacyAudienceFormats: true );

builder.Services.AddControllers(); var app = builder.Build();

app.UseAuthentication(); app.UseAuthorization(); app.UseTenantValidation(); app.MapControllers(); app.Run(); `

Configuration

json { "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "yourdomain.onmicrosoft.com", "TenantId": "your-tenant-id", "ClientId": "your-client-id", "Audience": "api://your-client-id" } }

Features

  • ๐Ÿ”’ Multi-tenant security with automatic tenant isolation
  • ๐Ÿข Enterprise-grade Azure AD integration
  • โšก High performance with memory caching
  • ๐Ÿ“Š Comprehensive logging and diagnostics
  • ๐Ÿ”ง Flexible audience validation (supports both 'appId' and 'api://appId')
  • โš™๏ธ Configurable authentication policies
  • ๐Ÿงช Well tested with unit and integration tests

Requirements

  • .NET 8.0 or later
  • Azure AD tenant with registered application

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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
2.0.0 149 8/14/2025

Major update v2.0.0 with enhanced Azure AD integration:
     
     NEW ENHANCED FEATURES:
     โœ… Flexible audience validation (supports both 'appId' and 'api://appId' formats)
     โœ… Configurable global authentication policy (optional authentication requirement)
     โœ… Enhanced logging and debugging capabilities with detailed error context
     โœ… Support for legacy audience formats (backward compatibility for Azure AD variations)
     โœ… Optional strict tenant validation (can be disabled for external apps)
     โœ… Production-tested with real Azure AD environments
     
     WHAT'S NEW:
     - AddEnhancedSaaSFactoryAzureADAuth() method with advanced configuration options
     - Flexible audience format handling for better Azure AD compatibility
     - Enhanced error logging with detailed validation context
     - Configurable authentication policies for different application types
     
     BACKWARD COMPATIBILITY:
     - Original AddSaaSFactoryAzureADAuth() method remains unchanged
     - Existing applications continue to work without modifications
     - All v1.x features preserved and enhanced
     
     MIGRATION GUIDE:
     - New projects: Use AddEnhancedSaaSFactoryAzureADAuth() for advanced features
     - Existing projects: No changes required, or optionally upgrade to enhanced method
     - External applications: Enhanced method provides better Azure AD compatibility
     
     Includes all v1.x features:
     - Strict per-tenant issuer/audience validation (fail-closed)
     - Composite tenant resolution (header, path, subdomain, claims)
     - DI-first setup with Microsoft.Identity.Web (JwtBearer)
     - Structured logging, metrics, and optional tracing
     - Dev-friendly idp-config endpoint and probe
     - Comprehensive unit/integration tests