Add SAMLResponseID and AuthnContextClassRef to response alterations - #92
Open
Fulvio Mercoliano (fume) wants to merge 2 commits into
Open
Add SAMLResponseID and AuthnContextClassRef to response alterations#92Fulvio Mercoliano (fume) wants to merge 2 commits into
Fulvio Mercoliano (fume) wants to merge 2 commits into
Conversation
…sponse alterations
There was a problem hiding this comment.
Pull request overview
This pull request extends the Proxy’s optional SAML response alteration feature set, enabling conditional injection of the SAML Response ID and the AuthnContextClassRef value into the assertion as new SAML attributes, driven by configuration and accompanied by new logging event IDs.
Changes:
- Extended
OptionalResponseAlterationOptionswith flags and configuration (attribute names +xsi:type) for the two new injected attributes. - Updated
FederatorResponseService.ApplyOptionalResponseAlterationto apply multiple independent alterations (DoB type change, Response ID injection, AuthnContextClassRef injection). - Added new
LoggingEventsIDs for the two new attribute-injection operations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
WebApps/Proxy/Microsoft.SPID.Proxy/Services/Implementations/FederatorResponseService.cs |
Adds two new alteration paths and a helper that injects new SAML attributes by cloning an existing template attribute. |
WebApps/Proxy/Microsoft.SPID.Proxy/Models/Options/OptionalResponseAlterationOptions.cs |
Adds configuration knobs (enable flags + name/type) for the new optional injections. |
WebApps/Proxy/Microsoft.SPID.Proxy/Models/LoggingEvents.cs |
Introduces two new event IDs for the injected-attribute logs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mtagliaferri86
previously approved these changes
May 27, 2026
…esponse processing
Comment on lines
+392
to
+403
| // Only set xsi:type if the template AttributeValue already had one, using the value supplied by the caller. | ||
| var existingTemplateValue = existingAttribute.ChildNodes.Cast<XmlNode>() | ||
| .FirstOrDefault(n => n.NodeType == XmlNodeType.Element && n.LocalName == "AttributeValue"); | ||
| var templateTypeAttr = existingTemplateValue?.Attributes?.Cast<XmlAttribute>() | ||
| .FirstOrDefault(a => a.LocalName == "type" && a.NamespaceURI == "http://www.w3.org/2001/XMLSchema-instance"); | ||
|
|
||
| if (templateTypeAttr != null && !string.IsNullOrWhiteSpace(xsiType)) | ||
| { | ||
| var typeAttr = doc.CreateAttribute(templateTypeAttr.Prefix, "type", templateTypeAttr.NamespaceURI); | ||
| typeAttr.Value = xsiType; | ||
| attributeValueElement.Attributes.Append(typeAttr); | ||
| } |
mtagliaferri86
approved these changes
Jun 1, 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.
This pull request extends the optional SAML response alteration functionality to allow adding new attributes to the SAML response based on configuration. In addition to the existing date of birth alteration, it introduces options to add the SAML Response ID and AuthnContextClassRef as SAML attributes. The implementation ensures these attributes are only added when configured and logs the operations accordingly.
New optional SAML attribute injection features:
OptionalResponseAlterationOptionsfor injecting the SAML Response ID and AuthnContextClassRef as SAML attributes, including configuration for their names and types.ApplyOptionalResponseAlterationinFederatorResponseServiceto conditionally apply the new attribute injections using dedicated helper methods.ApplySAMLResponseIDAttributeAlterationandApplyAuthnContextClassRefAttributeAlterationmethods to extract the relevant values from the SAML response and add them as attributes, using a template-based approach for consistency.Logging enhancements:
LoggingEvents.