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

Function deflateAndEncode

redirect_binding.go:316–335  ·  view source on GitHub ↗

deflateAndEncode serializes el, deflates it and base64 encodes the result, as the HTTP-Redirect binding requires.

(el *etree.Element)

Source from the content-addressed store, hash-verified

314// deflateAndEncode serializes el, deflates it and base64 encodes the result,
315// as the HTTP-Redirect binding requires.
316func deflateAndEncode(el *etree.Element) (string, error) {
317 var rv strings.Builder
318 base64Writer := base64.NewEncoder(base64.StdEncoding, &rv)
319 compressedWriter, err := flate.NewWriter(base64Writer, 9)
320 if err != nil {
321 return "", err
322 }
323 doc := etree.NewDocument()
324 doc.SetRoot(el)
325 if _, err := doc.WriteTo(compressedWriter); err != nil {
326 return "", err
327 }
328 if err := compressedWriter.Close(); err != nil {
329 return "", err
330 }
331 if err := base64Writer.Close(); err != nil {
332 return "", err
333 }
334 return rv.String(), nil
335}
336
337// MaxRelayStateLength is the longest RelayState, in bytes, that a SAML
338// message may carry with the HTTP-Redirect, HTTP-POST and

Callers 8

TestIDPServeSLORoundTripFunction · 0.85
logoutRequestWriterMethod · 0.85
rawSignedRedirectURLFunction · 0.85
RedirectMethod · 0.85
spSendLogoutResponseFunction · 0.85

Calls 2

StringMethod · 0.80
CloseMethod · 0.45

Tested by 3

TestIDPServeSLORoundTripFunction · 0.68
rawSignedRedirectURLFunction · 0.68
spSendLogoutResponseFunction · 0.68