Skip to content

Commit 52248b6

Browse files
authored
Merge pull request #33 from peteat/support-idp-WantAuthnRequestsSigned
Support IdP WantAuthnRequestsSigned.
2 parents ccb04f5 + 15c2f12 commit 52248b6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/ITfoxtec.Identity.Saml2/Schemas/Metadata/IdPSsoDescriptor.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ public class IdPSsoDescriptor : SsoDescriptorType
1515
{
1616
const string elementName = Saml2MetadataConstants.Message.IdPSsoDescriptor;
1717

18+
/// <summary>
19+
/// [Optional]
20+
/// Optional attribute that indicates to service providers whether or not they can expect an
21+
/// unsigned &lt;AuthnRequest&gt; message to be accepted by the identity provider.
22+
/// If omitted, the value is assumed to be false.
23+
/// </summary>
24+
public bool? WantAuthnRequestsSigned { get; set; }
25+
1826
/// <summary>
1927
/// One or more elements of type EndpointType that describe endpoints that support the profiles of the
2028
/// Authentication Request protocol defined in [SAMLProf]. All identity providers support at least one
@@ -35,6 +43,11 @@ protected IEnumerable<XObject> GetXContent()
3543
{
3644
yield return new XAttribute(Saml2MetadataConstants.Message.ProtocolSupportEnumeration, protocolSupportEnumeration);
3745

46+
if (WantAuthnRequestsSigned.HasValue)
47+
{
48+
yield return new XAttribute(Saml2MetadataConstants.Message.WantAuthnRequestsSigned, WantAuthnRequestsSigned.Value);
49+
}
50+
3851
if (EncryptionCertificates != null)
3952
{
4053
foreach (var encryptionCertificate in EncryptionCertificates)
@@ -78,6 +91,8 @@ protected IEnumerable<XObject> GetXContent()
7891

7992
protected internal IdPSsoDescriptor Read(XmlElement xmlElement)
8093
{
94+
WantAuthnRequestsSigned = xmlElement.Attributes[Saml2MetadataConstants.Message.WantAuthnRequestsSigned]?.Value.Equals(true.ToString(), StringComparison.InvariantCultureIgnoreCase);
95+
8196
var signingKeyDescriptorElements = xmlElement.SelectNodes($"*[local-name()='{Saml2MetadataConstants.Message.KeyDescriptor}'][contains(@use,'{Saml2MetadataConstants.KeyTypes.Signing}') or not(@use)]");
8297
if (signingKeyDescriptorElements != null)
8398
{

src/ITfoxtec.Identity.Saml2/Schemas/Metadata/Saml2MetadataConstants.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public class Message
6666
public const string ResponseLocation = "ResponseLocation";
6767

6868
public const string ProtocolSupportEnumeration = "protocolSupportEnumeration";
69-
69+
70+
public const string WantAuthnRequestsSigned = "WantAuthnRequestsSigned";
71+
7072
public const string AuthnRequestsSigned = "AuthnRequestsSigned";
7173

7274
public const string WantAssertionsSigned = "WantAssertionsSigned";

0 commit comments

Comments
 (0)