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

Function soapHTTPClient

soap.go:53–72  ·  view source on GitHub ↗

soapHTTPClient returns the HTTP client to send a SOAP message with: defaultSOAPHTTPClient when client is nil, and otherwise a copy of client whose redirect policy also refuses to follow a redirect to a location that checkSOAPEndpoint would refuse. Without that, a 307 or 308 from an https endpoint to

(client *http.Client, allowInsecure bool)

Source from the content-addressed store, hash-verified

51// endpoint to a plain http one would re-send the message, with the NameID,
52// attributes or assertion it carries, in the clear.
53func soapHTTPClient(client *http.Client, allowInsecure bool) *http.Client {
54 if client == nil {
55 return defaultSOAPHTTPClient
56 }
57 c := *client
58 next := client.CheckRedirect
59 c.CheckRedirect = func(req *http.Request, via []*http.Request) error {
60 if err := checkSOAPEndpoint(req.URL.String(), allowInsecure); err != nil {
61 return fmt.Errorf("refusing to follow redirect: %w", err)
62 }
63 if next != nil {
64 return next(req, via)
65 }
66 if len(via) >= 10 {
67 return errors.New("stopped after 10 redirects")
68 }
69 return nil
70 }
71 return &c
72}
73
74// ErrInsecureSOAPEndpoint is returned when a SAML SOAP message would be sent
75// to an endpoint whose Location is not an https URL. SOAP messages go

Callers 3

handleArtifactRequestMethod · 0.85
postSOAPMethod · 0.85

Calls 4

checkSOAPEndpointFunction · 0.85
StringMethod · 0.80
NewMethod · 0.65
nextFunction · 0.50

Tested by 1