Add logging and setting overrides for active SAML ACS URL(s) (PP-4899) - #3631
Conversation
Greptile SummaryThe PR adds configurable SAML Assertion Consumer Service endpoint selection and improves diagnostics for ACS mismatches.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/palace/manager/integration/patron_auth/saml/auth.py | Adds ACS omission for deferred selection and endpoint-aware authentication diagnostics; no eligible follow-up issue remains. |
| src/palace/manager/integration/patron_auth/saml/configuration/model.py | Adds integration-level policy configuration and resolves it against the environment and built-in defaults. |
| src/palace/manager/integration/patron_auth/saml/configuration/service_provider.py | Adds validated environment configuration for the site-wide ACS selection policy. |
| src/palace/manager/integration/patron_auth/saml/metadata/parser.py | Implements policy-driven ACS selection, numeric index handling, XML boolean parsing, and completes the previously requested constructor annotations. |
| src/palace/manager/integration/patron_auth/saml/metadata/model.py | Defines the externally persisted ACS selection policies and compatibility-preserving default. |
Sequence Diagram
sequenceDiagram
participant Patron
participant Palace
participant Metadata as SP Metadata
participant IdP
Palace->>Metadata: Resolve effective ACS selection policy
Metadata-->>Palace: Selected ACS endpoint
Patron->>Palace: Start SAML authentication
Palace->>IdP: AuthnRequest with selected ACS or no ACS
IdP-->>Palace: SAML response at an ACS endpoint
Palace->>Palace: Log endpoint choice or mismatch
Palace->>Palace: Validate SAML response
Reviews (3): Last reviewed commit: "Add a clarifying comment" | Re-trigger Greptile
|
Claude finished @tdilauro's task in 11m 37s —— View job Code Review
SummarySolid, well-documented change: the policy resolution (integration setting → env → built-in default) has a single source of truth in Details
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3631 +/- ##
==========================================
+ Coverage 93.52% 93.54% +0.02%
==========================================
Files 512 509 -3
Lines 46760 46854 +94
Branches 6379 6406 +27
==========================================
+ Hits 43731 43829 +98
+ Misses 1958 1955 -3
+ Partials 1071 1070 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| # Names shown in the administrative interface. Also used in the field's description, so | ||
| # that the stated default follows DEFAULT_ACS_SELECTION_POLICY rather than being restated. | ||
| ACS_SELECTION_POLICY_LABELS: Final[Mapping[SAMLACSSelectionPolicy, str]] = frozendict( |
There was a problem hiding this comment.
I like the type hint here! I usually annotate these as FrozenDict, but Final[Mapping[ is really nice.
|
|
||
| # Name no endpoint at all, leaving the identity provider to use whichever one it | ||
| # has registered. A mismatch between the two sides then cannot arise. | ||
| DEFER_TO_IDP = "defer_to_idp" |
There was a problem hiding this comment.
Nit: You could probably use StrEnum and auto() to avoid repeating these.
There was a problem hiding this comment.
I was going to use strEnum, but noticed that just about everything else there was enums. I'll got ahead and do that.
There was a problem hiding this comment.
Actually, I don't think I want to use auto() here, since the values might be used by the env var override. So someone changing the member name would break that. I'll add a comment about it, though, so it's more evident.
|
Claude's assertion in its latest round
is simply wrong. That broken behavior was the main impetus for this PR. It is implemented as a settings feature only because simply fixing the bug would've broken any active integration that was affected by the bug, which would've been most all of them. |
Description
SAML Service Provider metadata may declare more than one callback (Assertion Consumer Service)
endpoint. Until now, the endpoint named in our authentication requests was fixed, so moving to a different one was not possible without a code or per-integration SP metadata change.
Each SAML integration can now choose how that endpoint is selected:
isDefaultattribute in the metadataAdds our own logging that identifies when a response arrives at an endpoint other than one we expected, which previously could only be diagnosed from an (external) IdPs error message.
Improves endpoint selection, which previously ignored the metadata's own default attribute and compared endpoint indexes as text rather than as numbers.
Existing integrations are unaffected, as the default reproduces current behavior.
Motivation and Context
Some patron auth integrations need to move to a different SAML callback endpoint, but that change has to be coordinated with each identity provider partner individually. Making the choice a per-integration setting allows endpoints to be migrated incrementally, rather than requiring every partner to change at the same time.
[Jira PP-4899]
How Has This Been Tested?
Checklist