MCPcopy Create free account
hub / github.com/crewjam/saml / TestCanParseMetadata

Function TestCanParseMetadata

metadata_test.go:13–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestCanParseMetadata(t *testing.T) {
14 buf := golden.Get(t, "TestCanParseMetadata_metadata.xml")
15
16 metadata := EntityDescriptor{}
17 err := xml.Unmarshal(buf, &metadata)
18 assert.Check(t, err)
19
20 var False = false
21 var True = true
22
23 expected := EntityDescriptor{
24 EntityID: "https://dev.aa.kndr.org/users/auth/saml/metadata",
25 ID: "_af805d1c-c2e3-444e-9cf5-efc664eeace6",
26 ValidUntil: time.Date(2001, time.February, 3, 4, 5, 6, 789000000, time.UTC),
27 CacheDuration: time.Hour,
28 SPSSODescriptors: []SPSSODescriptor{
29 {
30 XMLName: xml.Name{Space: "urn:oasis:names:tc:SAML:2.0:metadata", Local: "SPSSODescriptor"},
31 SSODescriptor: SSODescriptor{
32 RoleDescriptor: RoleDescriptor{
33 ProtocolSupportEnumeration: "urn:oasis:names:tc:SAML:2.0:protocol",
34 },
35 },
36 AuthnRequestsSigned: &False,
37 WantAssertionsSigned: &False,
38 AssertionConsumerServices: []IndexedEndpoint{
39 {
40 Binding: "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
41 Location: "https://dev.aa.kndr.org/users/auth/saml/callback",
42 Index: 0,
43 IsDefault: &True,
44 },
45 },
46 AttributeConsumingServices: []AttributeConsumingService{
47 {
48 Index: 1,
49 IsDefault: &True,
50 ServiceNames: []LocalizedName{{Lang: "en", Value: "Required attributes"}},
51 RequestedAttributes: []RequestedAttribute{
52 {
53 Attribute: Attribute{
54 FriendlyName: "Email address",
55 Name: "email",
56 NameFormat: "urn:oasis:names:tc:SAML:2.0:attrname-format:basic",
57 },
58 },
59 {
60 Attribute: Attribute{
61 FriendlyName: "Full name",
62 Name: "name",
63 NameFormat: "urn:oasis:names:tc:SAML:2.0:attrname-format:basic",
64 },
65 },
66 {
67 Attribute: Attribute{
68 FriendlyName: "Given name",
69 Name: "first_name",
70 NameFormat: "urn:oasis:names:tc:SAML:2.0:attrname-format:basic",

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected