Skip to content

feat(JwtBearer): empty-JWKS detection + periodic authority re-validation - #5

Merged
MPCoreDeveloper merged 2 commits into
masterfrom
feature/jwtbearer-periodic-and-keys
Sep 10, 2026
Merged

feat(JwtBearer): empty-JWKS detection + periodic authority re-validation#5
MPCoreDeveloper merged 2 commits into
masterfrom
feature/jwtbearer-periodic-and-keys

Conversation

@MPCoreDeveloper

Copy link
Copy Markdown
Owner

What

Adds the two most-complete options requested to close the remaining gaps for SafeWebCore.JwtBearer:

  1. Empty-JWKS detection — a discovery document that loads but contains no signing keys is now a permanent configuration error: Error log + startup throw when FailFast, down-gradable to a Warning via RequireSigningKeys = false. Covers the misconfiguration where the IdP responds 200 but provides no keys (every token would otherwise fail with "no signing keys").

  2. Periodic re-validation — optional PeriodicValidationInterval runs a background timer that re-probes the metadata endpoint while the app runs. It never throws (a running server is never killed): permanent (4xx) failures log at Error, transient at Warning. This closes the last-known-good observability gap: IdentityModel otherwise serves the cached metadata without throwing, so an IdP outage after a healthy start stays invisible.

Guard refactored (ValidateAuthorityAsync/ReportConfigurationResult/ReportMetadataFailure) and made IDisposable (CancellationTokenSource lifecycle).

Verification

  • dotnet build SafeWebCore.slnx -c Release — 0 warnings / 0 errors
  • dotnet test SafeWebCore.slnx -c Release168/168 passed (38 JwtBearer tests, +5 new)
  • PublicAPI baseline updated (+4 entries)
  • README + CHANGELOG updated

SonarCloud analysis on this PR will run automatically; fixes applied until the Quality Gate is green, then merge.

@sonarqubecloud

Copy link
Copy Markdown

@MPCoreDeveloper
MPCoreDeveloper merged commit a91bcb0 into master Sep 10, 2026
2 checks passed
@MPCoreDeveloper
MPCoreDeveloper deleted the feature/jwtbearer-periodic-and-keys branch September 10, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant