Repository navigation
fix: refresh SAML signing certificates and fail logins cleanly when the IdP is unreachable - #31
Merged
jbeers merged 1 commit intoNov 9, 2026
Conversation
…he IdP is unreachable The provider read its federation metadata once per application lifetime, so an IdP certificate rotation broke every login until a restart. It now re-reads the metadata every certificateRefreshMinutes (default 60) and keeps the held certificates when a refresh fails. OpenSAML initialisation and the metadata fetch moved to first use, so an unreachable metadata URL surfaced as an unhandled error from both entry points. processAuthorizationEvent now reports a failed login, and Auth.start redirects to errorRedirect.
jbeers
approved these changes
Nov 9, 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.
Three fixes in
MicrosoftSAMLProviderandAuth.start, all to do with the IdP's metadata endpoint:initializeOpenSAMLLib()setcertificatesCached = trueonce and never re-read the metadata. When the IdP rotated its signing certificate (Entra does this on expiry, or whenever an admin activates a new one), every login failed signature verification until the application restarted. The metadata is now re-read everycertificateRefreshMinutes(default 60, settable on the provider definition). If a refresh fails, the certificates already held stay in use:cacheCertsonly replaces them once new ones parse. The refresh is then retried after 5 minutes. A failed first fetch still throws, because there is nothing to verify with.processAuthorizationEventthrew on an unreachable metadata URL.initializeOpenSAMLLib()ran before thetry, so a metadata timeout surfaced as an unhandled error instead of a failedSSOAuthorizationResponse. It now runs inside thetry.Auth.startthrew on the same failure. Since 3.x moved initialisation and the metadata fetch to first use,startAuthenticationWorflow()is where they first run.start()now logs the error and redirects toerrorRedirect. Therelocate()stays outside thetry, because relocate aborts the request and a catch would swallow that.The changelog has entries under Unreleased, and the readme has a short "SAML signing certificates" section.
Tests
MicrosoftSAMLProviderSpeccovers:AuthHandlerSpecadds a check thatstart()redirects toerrorRedirectwhen the provider throws.cfformat checkpasses on the changed files.🤖 Generated with Claude Code