The Cookbook
Auth
- Asymmetric JWT token usage
- Standard JWT Auth with Swagger support
- API Key Auth with Swagger support
- Session based Auth with Swagger support
- Basic Auth with Swagger support
- Dynamic claim/permission hydration (using IClaimsTransformation) instead of embedding in JWT
- Custom Authorization Handler (IAuthorizationHandler) Example
- MS Identity API Endpoints middleware config
- Sending a custom 401 response on Authentication failure
Configuration
Middleware & Pipeline
- IEndpointFilter usage
- Correct middleware order for Blazor Server-Side
- Correct middleware order for UseSpa() from Microsoft.AspNetCore.SpaServices.Extensions
- Legacy host-builder style with Startup.cs file
Persistence
Results Pattern
- Usage with Ardalis.Result package
- Results pattern with Post-Processor doing the response sending
- Results pattern with ErrorOr package
Serialization
- Receiving and sending of XML via custom binder and send method
- JsonPatch usage with Swagger UI support
- Streaming JSON response with IAsyncEnumerable
Swagger
- Customizing Swagger Spec With An IOperationProcessor
- Customizing Swagger Middleware & SwaggerUi Paths
- OneOf support for polymorphic schema
Testing
- Integration testing with TestContainers & AppFixture
- Unit testing an endpoint that executes a command
- Unit testing an endpoint that publishes an event
Validation
- Adding & Throwing validation errors from deeper domain layers
- Request DTO inheritance and composition of Validators
- Validator inheritance for polymorphic DTOs.