How openiddict/openiddict-core works
Purpose and entry points
OpenIddict is a modular .NET framework for implementing OAuth 2.0/OpenID Connect clients, authorization servers, and token validation—not a deployable identity product. Consumers compose services through builders/extensions and select hosting, persistence, and protection adapters. The solution is OpenIddict.slnx; package entry APIs begin at src/OpenIddict.Abstractions/OpenIddictBuilder.cs, src/OpenIddict.Client/OpenIddictClientBuilder.cs, and src/OpenIddict.Server/OpenIddictServerBuilder.cs.
Shared contracts and domain boundary
OpenIddict.Abstractions defines protocol primitives, constants, descriptors, and persistence contracts. Requests/responses/messages form the protocol data boundary; descriptors model applications, authorizations, resources, scopes, sessions, and tokens. Managers and store interfaces isolate domain operations from databases.
Paths: src/OpenIddict.Abstractions/Primitives/OpenIddictRequest.cs, src/OpenIddict.Abstractions/Stores/IOpenIddictTokenStore.cs, src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs.
Core persistence orchestration
OpenIddict.Core implements manager and cache services over the abstract stores. This is the central application-data layer used by server behavior and configurable independently of concrete persistence. Entity Framework Core, EF6, and MongoDB provide entity models, configuration/context, and store implementations; custom stores can replace them.
Paths: src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs, src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs, src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs.
Client protocol pipeline
The client subsystem represents each operation as a transaction/event context and dispatches ordered, filterable handlers for discovery, authorization, device flow, token exchange, introspection, revocation, session, userinfo, and protection. HTTP transport and provider-specific web integrations are separate adapters; system integration adds native callback activation/listening for desktop/mobile platforms.
Paths: src/OpenIddict.Client/OpenIddictClientDispatcher.cs, src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs, src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Discovery.cs, src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationService.cs.
Server protocol pipeline
The server similarly routes endpoint-specific transactions through dispatchers and handlers. It covers authentication/authorization, discovery, token exchange, device authorization, introspection, revocation, logout/session, and userinfo. Application-specific identity, consent, and authorization UI remain outside the framework, typically implemented by host controllers.
Paths: src/OpenIddict.Server/OpenIddictServerDispatcher.cs, src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs, src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs.
Host, validation, and security adapters
ASP.NET Core and OWIN packages bridge host middleware/request features into the client, server, and validation pipelines. Validation has its own dispatcher and can obtain configuration/introspection data through System.Net.Http or integrate with a colocated server. Data Protection adapters implement protected-token formatting; Quartz supplies scheduled maintenance execution.
Paths: src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandler.cs, src/OpenIddict.Validation/OpenIddictValidationDispatcher.cs, src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs, src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionFormatter.cs, src/OpenIddict.Quartz/OpenIddictQuartzJob.cs.
Runtimes, examples, and delivery
Primary runtimes are .NET, ASP.NET Core, ASP.NET/OWIN, and client OS integrations; external persistence targets are EF Core, EF6, and MongoDB. Sandboxes demonstrate executable hosts across ASP.NET Core, classic ASP.NET, console, MAUI, WinForms, and WPF, with server/client requests crossing normal OAuth/OIDC HTTP boundaries. A source generator produces web-integration provider code from provider metadata. Build scripts/package settings support NuGet distribution and CI.
Paths: sandbox/OpenIddict.Sandbox.AspNetCore.Server/Program.cs, sandbox/OpenIddict.Sandbox.Maui.Client/MauiProgram.cs, gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs.
Main entry points: OpenIddictServerDispatcher.cs Server dispatcher · OpenIddictClientDispatcher.cs Client dispatcher · OpenIddictTokenManager.cs Core managers and cache · OpenIddictBuilder.cs Service builders
Components 22
Foundation
Shared contracts and persistence orchestration.
- Service builders · Consumers compose OpenIddict services and adapters.
src/OpenIddict.Abstractions/OpenIddictBuilder.cs - Protocol messages · OAuth/OIDC protocol data boundary.
src/OpenIddict.Abstractions/Primitives/OpenIddictRequest.cs - Store contracts · Abstract persistence boundary for domain entities.
src/OpenIddict.Abstractions/Stores/IOpenIddictTokenStore.cs - Manager contracts · Application-domain operations exposed to protocol services.
src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs - Core managers and cache · Implements managers over abstract stores.
src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
Protocol engines
Event-driven client, server, and validation processing.
- Client dispatcher · Runs ordered, filterable client handlers per transaction.
src/OpenIddict.Client/OpenIddictClientDispatcher.cs - Client exchange handlers · Handles token and related client exchanges.
src/OpenIddict.Client/OpenIddictClientHandlers.Exchange.cs - Server dispatcher · Routes endpoint transactions through server handlers.
src/OpenIddict.Server/OpenIddictServerDispatcher.cs - Server authentication handlers
src/OpenIddict.Server/OpenIddictServerHandlers.Authentication.cs - Server exchange handlers · Handles token exchange processing.
src/OpenIddict.Server/OpenIddictServerHandlers.Exchange.cs - Validation dispatcher · Processes token validation transactions.
src/OpenIddict.Validation/OpenIddictValidationDispatcher.cs
Adapters and runtimes
Hosting, transport, protection, storage, and scheduling integrations.
- EF Core, EF6, MongoDB stores · Replaceable concrete store implementations.
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs - MongoDB application store
src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs - System.Net.Http adapters · Provides discovery and remote introspection transport.
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.Discovery.cs - Client system integration · Activates and listens for desktop/mobile callbacks.
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationService.cs - ASP.NET Core host bridge · Bridges ASP.NET Core request features into protocol pipelines.
src/OpenIddict.Server.AspNetCore/OpenIddictServerAspNetCoreHandler.cs - Validation introspection
src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.Introspection.cs - Data Protection formatter · Formats protected server tokens.
src/OpenIddict.Server.DataProtection/OpenIddictServerDataProtectionFormatter.cs - Quartz maintenance job · Executes scheduled maintenance work.
src/OpenIddict.Quartz/OpenIddictQuartzJob.cs
Examples and delivery
Executable hosts and generated provider integrations.
- Web integration generator · Generates provider-specific web integration code.
gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs - ASP.NET Core server sandbox · Example OAuth/OIDC server host.
sandbox/OpenIddict.Sandbox.AspNetCore.Server/Program.cs - MAUI client sandbox · Example native client host.
sandbox/OpenIddict.Sandbox.Maui.Client/MauiProgram.cs
Connections 25
- Service builders → Store contracts: configures
- Service builders → Core managers and cache: registers
- Service builders → Client dispatcher: composes
- Service builders → Server dispatcher: composes
- Store contracts → Core managers and cache: implemented behind
- Manager contracts → Core managers and cache: implemented by
- EF Core, EF6, MongoDB stores → Store contracts: implements
- MongoDB application store → Store contracts: implements
- Client dispatcher → Client exchange handlers: dispatches
- Client dispatcher → Protocol messages: processes
- Client dispatcher → System.Net.Http adapters: uses
- Client dispatcher → Client system integration: uses
- Server dispatcher → Server authentication handlers: dispatches
- Server dispatcher → Server exchange handlers: dispatches
- Server dispatcher → Core managers and cache: uses
- Server dispatcher → Protocol messages: processes
- ASP.NET Core host bridge → Server dispatcher: bridges requests to
- Server dispatcher → Data Protection formatter: formats tokens with
- Quartz maintenance job → Core managers and cache: maintains
- Validation dispatcher → Validation introspection: uses
- Validation introspection → System.Net.Http adapters: uses transport
- Web integration generator → Client dispatcher: generates integrations for
- ASP.NET Core server sandbox → ASP.NET Core host bridge: demonstrates
- MAUI client sandbox → Client system integration: demonstrates
- MAUI client sandbox → Client dispatcher: issues OAuth/OIDC requests