Entra.EventHandlers.AspNetCore
1.5.5
See the version list below for details.
dotnet add package Entra.EventHandlers.AspNetCore --version 1.5.5
NuGet\Install-Package Entra.EventHandlers.AspNetCore -Version 1.5.5
<PackageReference Include="Entra.EventHandlers.AspNetCore" Version="1.5.5" />
<PackageVersion Include="Entra.EventHandlers.AspNetCore" Version="1.5.5" />
<PackageReference Include="Entra.EventHandlers.AspNetCore" />
paket add Entra.EventHandlers.AspNetCore --version 1.5.5
#r "nuget: Entra.EventHandlers.AspNetCore, 1.5.5"
#:package Entra.EventHandlers.AspNetCore@1.5.5
#addin nuget:?package=Entra.EventHandlers.AspNetCore&version=1.5.5
#tool nuget:?package=Entra.EventHandlers.AspNetCore&version=1.5.5
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, dependency injection, endpoint routing, HTTP adaptation, 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 incoming event requests
- Resolves handlers
- Executes handlers
- Serializes event responses
- Maps exceptions to HTTP responses
- Uses
IHttpAdapterfor HTTP request and response adaptation
Recommended Hosting Model
The recommended approach is a single router endpoint capable of handling multiple Microsoft Entra event types.
Benefits include:
- 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 through the same orchestration pipeline.
Dependency Injection
Register Entra.EventHandlers services:
builder.Services.AddEntraEventHandlers();
This automatically registers:
IHttpAdapter- 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
Ecosystem Architecture
The Entra.EventHandlers ecosystem is organized into layers:
- Entra.EventHandlers.Abstractions provides shared protocol contracts
- Entra.EventHandlers provides External ID implementations
- Entra.EventHandlers.Workforce provides Workforce implementations
- Entra.EventHandlers.Security provides PasswordSubmit security integrations
- Entra.EventHandlers.AspNetCore provides ASP.NET Core hosting integration
- Entra.EventHandlers.AzureFunctions provides Azure Functions hosting integration
Applications typically reference one or more implementation packages together with a hosting package.
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 infrastructure.
Benefits include:
- Fast unit tests
- Simple mocking
- Dependency injection support
- Clear separation of concerns
Example:
var result = await handler.HandleAsync(request);
ASP.NET Core endpoints should remain thin transport 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 adapter |
| 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 the MIT License.
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.1)
- 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 http adapter, endpoint base classes, DI integration, unified
execution pipeline, router endpoint, and single-event endpoint mapping extensions.