Skip to content

Commit 1ffce9c

Browse files
authored
Merge pull request #70 from EugeneZhudro/master
Fix AssertionConsumerServiceURL
2 parents d3e990d + 036d5bf commit 1ffce9c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/ITfoxtec.Identity.Saml2/Request/Saml2AuthnRequest.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ public class Saml2AuthnRequest : Saml2Request
5555
/// </summary>
5656
public Uri AssertionConsumerServiceUrl { get; set; }
5757

58+
/// <summary>
59+
/// [Optional]
60+
///A URI reference that identifies a SAML protocol binding to be used when returning the &lt;Response&gt;
61+
///message.See[SAMLBind] for more information about protocol bindings and URI references defined
62+
///for them.This attribute is mutually exclusive with the AssertionConsumerServiceIndex attribute
63+
///and is typically accompanied by the AssertionConsumerServiceURL attribute.
64+
/// </summary>
65+
public Uri ProtocolBinding { get; set; }
66+
5867
/// <summary>
5968
/// [Optional]
6069
/// If present, specifies a filter for possible responses. Such a query asks the question "What assertions
@@ -110,6 +119,11 @@ protected override IEnumerable<XObject> GetXContent()
110119
yield return new XAttribute(Saml2Constants.Message.AssertionConsumerServiceURL, AssertionConsumerServiceUrl);
111120
}
112121

122+
if (ProtocolBinding != null)
123+
{
124+
yield return new XAttribute(Saml2Constants.Message.ProtocolBinding, ProtocolBinding);
125+
}
126+
113127
if (Subject != null)
114128
{
115129
yield return Subject.ToXElement();
@@ -134,7 +148,9 @@ protected internal override void Read(string xml, bool validateXmlSignature = fa
134148

135149
IsPassive = XmlDocument.DocumentElement.Attributes[Saml2Constants.Message.IsPassive].GetValueOrNull<bool>();
136150

137-
AssertionConsumerServiceUrl = XmlDocument.DocumentElement[Saml2Constants.Message.AssertionConsumerServiceURL, Saml2Constants.AssertionNamespace.OriginalString].GetValueOrNull<Uri>();
151+
AssertionConsumerServiceUrl = XmlDocument.DocumentElement.Attributes[Saml2Constants.Message.AssertionConsumerServiceURL].GetValueOrNull<Uri>();
152+
153+
ProtocolBinding = XmlDocument.DocumentElement.Attributes[Saml2Constants.Message.ProtocolBinding].GetValueOrNull<Uri>();
138154

139155
Subject = XmlDocument.DocumentElement[Saml2Constants.Message.Subject, Saml2Constants.AssertionNamespace.OriginalString].GetElementOrNull<Subject>();
140156

src/ITfoxtec.Identity.Saml2/Schemas/Saml2Constants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public static class Message
9393

9494
internal const string AssertionConsumerServiceURL = "AssertionConsumerServiceURL";
9595

96+
internal const string ProtocolBinding = "ProtocolBinding";
97+
9698
internal const string RequestedAuthnContext = "RequestedAuthnContext";
9799

98100
internal const string Comparison = "Comparison";

0 commit comments

Comments
 (0)