Element returns an etree.Element representing the object in XML form.
()
| 334 | |
| 335 | // Element returns an etree.Element representing the object in XML form. |
| 336 | func (r *ArtifactResolve) Element() *etree.Element { |
| 337 | el := etree.NewElement("samlp:ArtifactResolve") |
| 338 | el.CreateAttr("xmlns:saml", "urn:oasis:names:tc:SAML:2.0:assertion") |
| 339 | el.CreateAttr("xmlns:samlp", "urn:oasis:names:tc:SAML:2.0:protocol") |
| 340 | |
| 341 | // Note: This namespace is not used by any element or attribute name, but |
| 342 | // is required so that the AttributeValue type element can have a value like |
| 343 | // "xs:string". If we don't declare it here, then it will be stripped by the |
| 344 | // cannonicalizer. This could be avoided by providing a prefix list to the |
| 345 | // cannonicalizer, but prefix lists do not appear to be implemented correctly |
| 346 | // in some libraries, so the safest action is to always produce XML that is |
| 347 | // (a) in canonical form and (b) does not require prefix lists. |
| 348 | el.CreateAttr("xmlns:xs", "http://www.w3.org/2001/XMLSchema") |
| 349 | |
| 350 | el.CreateAttr("ID", r.ID) |
| 351 | el.CreateAttr("Version", r.Version) |
| 352 | el.CreateAttr("IssueInstant", r.IssueInstant.Format(timeFormat)) |
| 353 | if r.Issuer != nil { |
| 354 | el.AddChild(r.Issuer.Element()) |
| 355 | } |
| 356 | artifact := etree.NewElement("samlp:Artifact") |
| 357 | artifact.SetText(r.Artifact) |
| 358 | el.AddChild(artifact) |
| 359 | if r.Signature != nil { |
| 360 | el.AddChild(r.Signature) |
| 361 | } |
| 362 | return el |
| 363 | } |
| 364 | |
| 365 | // SoapRequest returns a SOAP Envelope contining the ArtifactResolve request |
| 366 | func (r *ArtifactResolve) SoapRequest() *etree.Element { |