Open AcTeemo opened 3 days ago
Hello,
I have made some modifications to the Release503 branch to support your requirement.
Could you please follow these steps?
public class CustomSaml2AuthResponseEnricher : ISaml2AuthResponseEnricher
{
public void Enrich(Saml2SecurityToken securityToken)
{
var statements = securityToken.Assertion.Statements;
foreach (var statement in statements)
{
if (statement is Saml2AttributeStatement attributeStatement)
{
var userNameAttr = attributeStatement.Attributes.SingleOrDefault(a => a.FriendlyName == "username");
if(userNameAttr != null)
{
userNameAttr.Name = ClaimTypes.Upn;
userNameAttr.NameFormat = new Uri(Saml2MetadataConstants.AttributeNameFormat);
}
}
}
}
}
services.AddTransient<ISaml2AuthResponseEnricher, CustomSaml2AuthResponseEnricher>();
Thank you for your reply. This should be helpful for me, but I have one question: I'm not sure if there is a FriendlyName attribute, because I can't see the ResponseXml.
Hello! I need to add the red attributes shown in the image to the SAML response. How can I do that? plz give me some help. THX!!!!!