/// <summary> /// Appends xml for the Saml2LogoutResponse to the given parent node. /// </summary> /// <param name="parentNode">Xml for the Saml2LogoutResponse is appended /// to the children of this node.</param> public void AppendTo(XmlNode parentNode) { parentNode.StartElement("LogoutResponse", Saml2Namespaces.Saml2PUri) .AddAttribute("ID", Id.Value) .AddAttribute("Version", "2.0") .AddAttribute("IssueInstant", IssueInstant.ToSaml2DateTimeString()) .AddAttributeIfNotNull("InResponseTo", InResponseTo?.Value) .AddAttributeIfNotNull("Destination", DestinationUrl?.OriginalString) .If(Issuer != null, x => x.AddElement("Issuer", Saml2Namespaces.Saml2Uri, Issuer.Id)) .StartElement("Status", Saml2Namespaces.Saml2PUri) .StartElement("StatusCode", Saml2Namespaces.Saml2PUri) .AddAttribute("Value", StatusCodeHelper.FromCode(Status)); }
public override XElement ToXElement() { var xe = new XElement(Saml2Namespaces.Saml2P + "LogoutResponse", new XAttribute("ID", Id.Value), new XAttribute("Version", "2.0"), new XAttribute("IssueInstant", IssueInstant.ToSaml2DateTimeString()), new XElement(Saml2Namespaces.Saml2P + "Status", new XElement(Saml2Namespaces.Saml2P + "StatusCode", new XAttribute("Value", StatusCodeHelper.FromCode(Status))))); if (Issuer != null) { xe.AddFirst(new XElement(Saml2Namespaces.Saml2 + "Issuer", Issuer.Id)); } xe.AddAttributeIfNotNullOrEmpty("InResponseTo", InResponseTo?.Value); xe.AddAttributeIfNotNullOrEmpty("Destination", DestinationUrl?.OriginalString); return(xe); }