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

Method writePostForm

samlsp/middleware.go:334–352  ·  view source on GitHub ↗

writePostForm writes an HTML page holding form, the auto-submitting form of the HTTP-POST binding whose script has the hash scriptHash.

(w http.ResponseWriter, scriptHash string, form []byte)

Source from the content-addressed store, hash-verified

332// writePostForm writes an HTML page holding form, the auto-submitting form of
333// the HTTP-POST binding whose script has the hash scriptHash.
334func (m *Middleware) writePostForm(w http.ResponseWriter, scriptHash string, form []byte) {
335 w.Header().Add("Content-Security-Policy", ""+
336 "default-src; "+
337 "script-src '"+scriptHash+"'; "+
338 "reflected-xss block; referrer no-referrer;")
339 w.Header().Add("Content-type", "text/html")
340 setNoCacheHeaders(w.Header())
341 var buf bytes.Buffer
342 buf.WriteString(`<!DOCTYPE html>` +
343 `<html xmlns="http://www.w3.org/1999/xhtml">` +
344 `<head><title>Continue</title></head>` +
345 `<body>`)
346 buf.Write(form)
347 buf.WriteString(`</body></html>`)
348 if _, err := w.Write(buf.Bytes()); err != nil {
349 http.Error(w, err.Error(), http.StatusInternalServerError)
350 return
351 }
352}
353
354// CreateSessionFromAssertion is invoked by ServeHTTP when we have a new, valid SAML assertion.
355func (m *Middleware) CreateSessionFromAssertion(w http.ResponseWriter, r *http.Request, assertion *saml.Assertion, redirectURI string) {

Callers 5

sendLogoutRequestMethod · 0.95
postLogoutResponseMethod · 0.95
HandleStartAuthFlowMethod · 0.95
TestXHTMLReplayPageFunction · 0.80

Calls 5

BytesMethod · 0.80
setNoCacheHeadersFunction · 0.70
HeaderMethod · 0.45
WriteMethod · 0.45
ErrorMethod · 0.45

Tested by 1

TestXHTMLReplayPageFunction · 0.64