Refactor API to use IOptions pattern with IConfigurationSection binding#59
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #59 +/- ##
==========================================
+ Coverage 92.12% 92.67% +0.55%
==========================================
Files 26 29 +3
Lines 1358 1433 +75
Branches 154 164 +10
==========================================
+ Hits 1251 1328 +77
- Misses 75 76 +1
+ Partials 32 29 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
nandan-bhat
reviewed
May 19, 2026
nandan-bhat
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✏️ Changes
This PR refactors the public API surface to adopt the ASP.NET Core
IOptionspattern withIConfigurationSectionbinding, replacing the previous approach of eagerly-evaluatedAction<Auth0ApiOptions>callbacks that required users to manually wireJwtBearerOptionsinsideAuth0ApiOptions.Added:
Auth0ApiOptionsValidator— validatesDomainis set viaIValidateOptions<Auth0ApiOptions>Auth0JwtBearerConfigureOptions— implementsIConfigureNamedOptions<JwtBearerOptions>to resolveAuth0ApiOptionsat options resolution time (not registration time)Auth0JwtBearerOptionsValidator— validates audience is configured on the finalJwtBearerOptions, supporting both single-audience and multi-audience (ValidAudiences) scenariosServiceCollectionExtensionsoverloads acceptingIConfigurationSectionfor direct appsettings.json bindingModified:
Auth0ApiOptions— simplified to contain onlyDomainandAudience(removedJwtBearerOptionsproperty)Auth0ApiAuthenticationBuilder— no longer holdsAuth0ApiOptionsinstance; stores onlyAuthenticationSchemeandServicesAuthenticationBuilderExtensions— replacedAction<Auth0ApiOptions>parameter withAction<JwtBearerOptions>? configureJwtBearer; removed manual property copying inConfigureJwtBearerOptionsJwtBearerEventsFactory/DPoPEventsFactory— now acceptJwtBearerEvents?directly instead ofAuth0ApiOptionsServiceCollectionExtensions— delegate overloads now register options viaservices.Configure<Auth0ApiOptions>and delegate to theAuthenticationBuilder-based extensionRemoved:
ConfigureJwtBearerOptionsmethod (manual property-by-property copy)ValidateAuth0ApiOptionsmethod (replaced byIValidateOptionsimplementations)WithDPoPoverloads acceptingauthenticationSchemeparameter (usesbuilder.AuthenticationSchemeinstead)New public API usage:
🔗 References
🎯 Testing
This change adds unit test coverage
This change adds integration test coverage
This change has been tested on the latest version of the platform/language or why not
✅ Checklist
I have read the Auth0 general contribution guidelines
I have read the Auth0 Code of Conduct
All existing and new tests complete without errors
All commits are signed.