Element returns an etree.Element representing the object in XML form.
()
| 1080 | |
| 1081 | // Element returns an etree.Element representing the object in XML form. |
| 1082 | func (a *AuthnStatement) Element() *etree.Element { |
| 1083 | el := etree.NewElement("saml:AuthnStatement") |
| 1084 | el.CreateAttr("AuthnInstant", a.AuthnInstant.Format(timeFormat)) |
| 1085 | if a.SessionIndex != "" { |
| 1086 | el.CreateAttr("SessionIndex", a.SessionIndex) |
| 1087 | } |
| 1088 | if a.SessionNotOnOrAfter != nil { |
| 1089 | el.CreateAttr("SessionNotOnOrAfter", a.SessionNotOnOrAfter.Format(timeFormat)) |
| 1090 | } |
| 1091 | if a.SubjectLocality != nil { |
| 1092 | el.AddChild(a.SubjectLocality.Element()) |
| 1093 | } |
| 1094 | el.AddChild(a.AuthnContext.Element()) |
| 1095 | return el |
| 1096 | } |
| 1097 | |
| 1098 | // MarshalXML implements xml.Marshaler |
| 1099 | func (a *AuthnStatement) MarshalXML(e *xml.Encoder, start xml.StartElement) error { |