Element returns an etree.Element representing the object in XML form.
()
| 674 | |
| 675 | // Element returns an etree.Element representing the object in XML form. |
| 676 | func (r *AttributeQuery) Element() *etree.Element { |
| 677 | el := etree.NewElement("samlp:AttributeQuery") |
| 678 | el.CreateAttr("xmlns:saml", "urn:oasis:names:tc:SAML:2.0:assertion") |
| 679 | el.CreateAttr("xmlns:samlp", "urn:oasis:names:tc:SAML:2.0:protocol") |
| 680 | el.CreateAttr("ID", r.ID) |
| 681 | el.CreateAttr("Version", r.Version) |
| 682 | el.CreateAttr("IssueInstant", formatTime(r.IssueInstant)) |
| 683 | if r.Destination != "" { |
| 684 | el.CreateAttr("Destination", r.Destination) |
| 685 | } |
| 686 | if r.Consent != "" { |
| 687 | el.CreateAttr("Consent", r.Consent) |
| 688 | } |
| 689 | if r.Issuer != nil { |
| 690 | el.AddChild(r.Issuer.Element()) |
| 691 | } |
| 692 | if r.Signature != nil { |
| 693 | el.AddChild(r.Signature) |
| 694 | } |
| 695 | if r.Subject != nil { |
| 696 | el.AddChild(r.Subject.Element()) |
| 697 | } |
| 698 | for i := range r.Attributes { |
| 699 | el.AddChild(r.Attributes[i].Element()) |
| 700 | } |
| 701 | return el |
| 702 | } |
| 703 | |
| 704 | // SoapRequest returns a SOAP 1.1 Envelope containing the AttributeQuery, as |
| 705 | // the SAML SOAP binding sends it (saml-bindings §3.2). |
no test coverage detected