Entra.EventHandlers.AspNetCore
1.5.3
See the version list below for details.
dotnet add package Entra.EventHandlers.AspNetCore --version 1.5.3
NuGet\Install-Package Entra.EventHandlers.AspNetCore -Version 1.5.3
<PackageReference Include="Entra.EventHandlers.AspNetCore" Version="1.5.3" />
<PackageVersion Include="Entra.EventHandlers.AspNetCore" Version="1.5.3" />
<PackageReference Include="Entra.EventHandlers.AspNetCore" />
paket add Entra.EventHandlers.AspNetCore --version 1.5.3
#r "nuget: Entra.EventHandlers.AspNetCore, 1.5.3"
#:package Entra.EventHandlers.AspNetCore@1.5.3
#addin nuget:?package=Entra.EventHandlers.AspNetCore&version=1.5.3
#tool nuget:?package=Entra.EventHandlers.AspNetCore&version=1.5.3
Entra.EventHandlers.AspNetCore
ASP.NET Core hosting adapter for Microsoft Entra External ID and Microsoft Entra Workforce authentication event handlers.
This package provides ASP.NET Core integration for the Entra.EventHandlers ecosystem, enabling strongly typed event handlers with dependency injection, endpoint routing, request/response adapters, and centralized event orchestration.
Installation
dotnet add package Entra.EventHandlers.AspNetCore
Features
- ASP.NET Core integration
- Multi-event router endpoint
- Single-event endpoints
- Automatic request deserialization
- Automatic response serialization
- Dynamic handler resolution
- Centralized event orchestration
- Structured error handling
- Dependency injection integration
- Fully testable architecture
Quick Start
Register Entra.EventHandlers:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEntraEventHandlers();
var app = builder.Build();
app.MapEntraRouter();
app.Run();
The router endpoint automatically:
- Deserializes requests (Content-Type: application/json; UTF‑8)
- Resolves handlers
- Executes handlers
- Serializes responses (application/json; UTF‑8)
- Maps exceptions to HTTP responses (problem response contract with correlation ID when available)
- See IRequestAdapter and IResponseAdapter for request/response adaptation details.
Recommended Hosting Model
The recommended approach is a single router endpoint that can handle multiple Microsoft Entra event types.
Benefits:
- Single HTTP endpoint
- Centralized configuration
- Minimal boilerplate
- Automatic event dispatching
- Consistent error handling
- Easier maintenance
Router Endpoint
Register the router endpoint:
app.MapEntraRouter();
The router provides:
- Automatic event deserialization
- Event orchestration
- Dynamic handler resolution
- Handler invocation
- Response serialization
- Structured exception handling
A single endpoint can process multiple event types using the same orchestration pipeline.
Dependency Injection
Register Entra.EventHandlers services:
builder.Services.AddEntraEventHandlers();
This automatically registers:
- Request adapters
- Response adapters
- Event orchestrator
- Handler resolver
- Event handlers discovered in the application
- ASP.NET Core endpoint implementations
Most applications do not require additional Entra.EventHandlers registrations.
Handler Discovery
Handlers are automatically discovered and resolved using the incoming event type.
Example:
public class TokenIssuanceStartHandler(
ILogger<TokenIssuanceStartHandler> logger)
: TokenIssuanceStartHandlerBase(logger)
{
}
No manual registration is required.
When Microsoft Entra sends a matching event, the framework automatically resolves and executes the appropriate handler.
Alternative: Single-Event Endpoints
The package also provides dedicated endpoint mappings for individual events.
Available mappings:
app.MapEntraAttributeCollectionStart()app.MapEntraAttributeCollectionSubmit()app.MapEntraTokenIssuanceStart()app.MapEntraEmailOtpSend()app.MapEntraPasswordSubmit()app.MapEntraVerifiedIdClaimValidation()
Example:
app.MapEntraTokenIssuanceStart();
Single-event endpoints may be useful when:
- Each event requires its own route
- Teams manage events independently
- Routing is handled externally
Default Routes
| Endpoint | Route |
|---|---|
| Router | /router |
| AttributeCollectionStart | /attributecollectionstart |
| AttributeCollectionSubmit | /attributecollectionsubmit |
| TokenIssuanceStart | /tokenissuancestart |
| EmailOtpSend | /emailotpsend |
| PasswordSubmit | /passwordsubmit |
| VerifiedIdClaimValidation | /verifiedidclaimvalidation |
Supported Event Types
The hosting adapter supports all event handlers implemented using the Entra.EventHandlers ecosystem.
External ID
- AttributeCollectionStart
- AttributeCollectionSubmit
- EmailOtpSend
- PasswordSubmit
- TokenIssuanceStart
Workforce
- VerifiedIdClaimValidation
Testing
The hosting infrastructure is designed to be testable.
Because handlers remain isolated from hosting concerns, business logic can be tested without requiring ASP.NET Core hosting infrastructure.
Benefits include:
- Fast unit tests
- Simple mocking
- Dependency injection support
- Clear separation of concerns
Example:
var result = await handler.HandleAsync(request);
The ASP.NET Core endpoints should remain thin adapters while handlers contain the application behavior.
Documentation
Full documentation, event guides, hosting guides, and samples:
https://github.com/szubajak/entra-event-handlers/tree/main/docs
ASP.NET Core hosting guide:
https://github.com/szubajak/entra-event-handlers/blob/main/docs/hosting/aspnetcore.md
AI-friendly repository metadata:
https://github.com/szubajak/entra-event-handlers/blob/main/llms.txt
Samples
ASP.NET Core sample application:
https://github.com/szubajak/entra-event-handlers/tree/main/samples/ApiSample
The sample demonstrates:
- Dependency injection setup
- Router endpoint hosting
- Single-event endpoint hosting
- Event orchestration
- Shared handler implementations
Related Packages
| Package | Purpose |
|---|---|
| Entra.EventHandlers.Abstractions | Public contracts and protocol models |
| Entra.EventHandlers | External ID implementation layer |
| Entra.EventHandlers.Workforce | Workforce implementation layer |
| Entra.EventHandlers.AzureFunctions | Azure Functions hosting |
| Entra.EventHandlers.Security | PasswordSubmit decryption and Azure Key Vault integration |
License
This package is licensed under the Business Source License (BSL).
The Entra.EventHandlers.Abstractions package is licensed under MIT and may be used freely.
See the repository for licensing details and commercial licensing information.
Further Reading
Entra External ID .NET Handlers Deep Dive
https://medium.com/@jakub.szubarga/entra-external-id-dotnet-handlers-a7447dc1e437
Building CIAM-Ready Azure Functions with Entra.EventHandlers
https://medium.com/@jakub.szubarga/entra-eventhandlers-ciam-azure-functions-97c5e1940272
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Entra.EventHandlers.Abstractions (>= 1.6.0)
- Scrutor (>= 7.0.0)
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 |
|---|---|---|
| 1.6.0 | 121 | 11/16/2026 |
| 1.5.5 | 113 | 11/6/2026 |
| 1.5.4 | 137 | 10/27/2026 |
| 1.5.3 | 119 | 10/26/2026 |
| 1.5.2 | 131 | 10/25/2026 |
| 1.5.1 | 129 | 10/14/2026 |
| 1.5.0 | 128 | 10/9/2026 |
| 1.4.1 | 125 | 9/23/2026 |
| 1.4.0 | 132 | 9/14/2026 |
| 1.3.0 | 134 | 9/14/2026 |
| 1.2.9 | 153 | 9/10/2026 |
| 1.2.8 | 175 | 7/16/2026 |
| 1.2.7 | 159 | 6/29/2026 |
| 1.2.6 | 153 | 6/29/2026 |
| 1.2.5 | 140 | 6/29/2026 |
| 1.2.4 | 147 | 6/29/2026 |
| 1.2.3 | 152 | 6/29/2026 |
| 1.2.2 | 151 | 6/29/2026 |
| 1.2.1 | 162 | 6/29/2026 |
| 1.2.0 | 152 | 6/29/2026 |
Includes ASP.NET Core hosting adapter for Microsoft Entra External ID and Workforce Authentication
Event Handlers. Provides request/response adapters, endpoint base classes, DI integration, unified
execution pipeline, router endpoint, and single-event endpoint mapping extensions.