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

Function TestSPCanProcessResponseWithoutDestination

service_provider_test.go:935–952  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

933}
934
935func TestSPCanProcessResponseWithoutDestination(t *testing.T) {
936 test := NewServiceProviderTest(t)
937 s := ServiceProvider{
938 Key: test.Key,
939 Certificate: test.Certificate,
940 MetadataURL: mustParseURL("https://15661444.ngrok.io/saml2/metadata"),
941 AcsURL: mustParseURL("https://15661444.ngrok.io/saml2/acs"),
942 IDPMetadata: &EntityDescriptor{},
943 }
944 err := xml.Unmarshal(test.IDPMetadata, &s.IDPMetadata)
945 assert.Check(t, err)
946
947 req := http.Request{PostForm: url.Values{}}
948 test.replaceDestination("")
949 req.PostForm.Set("SAMLResponse", base64.StdEncoding.EncodeToString(test.SamlResponse))
950 _, err = s.ParseResponse(&req, []string{"id-9e61753d64e928af5a7a341a97f420c9"})
951 assert.Check(t, err)
952}
953
954func (test *ServiceProviderTest) responseDom() (doc *etree.Document) {
955 doc = etree.NewDocument()

Callers

nothing calls this directly

Calls 4

replaceDestinationMethod · 0.95
ParseResponseMethod · 0.95
NewServiceProviderTestFunction · 0.85
mustParseURLFunction · 0.50

Tested by

no test coverage detected