public void Saml2AuthenticationRequest_ToXElement_AddsAttributeConsumingServiceIndex() { var subject = new Saml2AuthenticationRequest() { AttributeConsumingServiceIndex = 17 }.ToXElement(); subject.Attribute("AttributeConsumingServiceIndex").Value.Should().Be("17"); }
private void Saml2AuthenticationRequest_ToXElement_AddsProtocolBinding(AuthServices.WebSso.Saml2BindingType protocolBinding, string expectedProtocolBinding) { var subject = new Saml2AuthenticationRequest() { AssertionConsumerServiceUrl = new Uri("http://destination.example.com"), Binding = protocolBinding }.ToXElement(); subject.Attribute("ProtocolBinding").Value.Should().Equals(expectedProtocolBinding); }
public void Saml2AuthenticationRequest_ToXElement_AddsRequestBaseFields() { // Just checking for the id field and assuming that means that the // base fields are added. The details of the fields are tested // by Saml2RequestBaseTests. var subject = new Saml2AuthenticationRequest().ToXElement(); subject.Should().NotBeNull().And.Subject.Attribute("ID").Should().NotBeNull(); subject.Attribute("AttributeConsumingServiceIndex").Should().BeNull(); }
public void Saml2AuthenticationRequest_ToXElement_AddsElementSaml2NameIdPolicy() { var subject = new Saml2AuthenticationRequest() { AssertionConsumerServiceUrl = new Uri("http://destination.example.com"), NameIdPolicy = new Saml2NameIdPolicy { AllowCreate = false, Format = NameIdFormat.EmailAddress } }.ToXElement(); XNamespace ns = "urn:oasis:names:tc:SAML:2.0:protocol"; subject.Attribute("AttributeConsumingServiceIndex").Should().BeNull(); subject.Should().NotBeNull().And.Subject.Element(ns + "NameIDPolicy").Should().NotBeNull(); }
public void Saml2AuthenticationRequest_ToXElement_AddsElementSaml2NameIdPolicy_ForAllowCreate() { var subject = new Saml2AuthenticationRequest() { AssertionConsumerServiceUrl = new Uri("http://destination.example.com"), NameIdPolicy = new Saml2NameIdPolicy(false, NameIdFormat.NotConfigured) }.ToXElement(); var expected = new XElement(Saml2Namespaces.Saml2P + "root", new XAttribute(XNamespace.Xmlns + "saml2p", Saml2Namespaces.Saml2P), new XElement(Saml2Namespaces.Saml2P + "NameIDPolicy", new XAttribute("AllowCreate", false))) .Elements().Single(); subject.Attribute("AttributeConsumingServiceIndex").Should().BeNull(); subject.Element(Saml2Namespaces.Saml2P + "NameIDPolicy") .Should().BeEquivalentTo(expected); }