An assertion in the default namespace, declared on the enclosing Response (as FusionAuth sends it), must keep that namespace when serialized alone.
(t *testing.T)
| 39 | // An assertion in the default namespace, declared on the enclosing Response |
| 40 | // (as FusionAuth sends it), must keep that namespace when serialized alone. |
| 41 | func TestElementToBytesInheritedDefaultNamespace(t *testing.T) { |
| 42 | const response = `<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">` + |
| 43 | `<Assertion ID="a"><Issuer>idp</Issuer><Subject><NameID>alice</NameID></Subject></Assertion>` + |
| 44 | `</samlp:Response>` |
| 45 | el := mustFindElement(t, response, "//Assertion") |
| 46 | assertStandalone(t, el) |
| 47 | |
| 48 | var assertion Assertion |
| 49 | assert.Assert(t, unmarshalElement(el, &assertion)) |
| 50 | assert.Check(t, is.Equal("idp", assertion.Issuer.Value)) |
| 51 | assert.Assert(t, assertion.Subject != nil && assertion.Subject.NameID != nil) |
| 52 | assert.Check(t, is.Equal("alice", assertion.Subject.NameID.Value)) |
| 53 | } |
| 54 | |
| 55 | // A prefix declared on an ancestor that differs from the element's own |
| 56 | // prefix (here ds:, declared only on the Response) must still be declared. |
nothing calls this directly
no test coverage detected