Entra.EventHandlers.AspNetCore 1.5.2

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

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.

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

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 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. 
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
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
Loading failed

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.