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)
| 332 | // writePostForm writes an HTML page holding form, the auto-submitting form of |
| 333 | // the HTTP-POST binding whose script has the hash scriptHash. |
| 334 | func (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. |
| 355 | func (m *Middleware) CreateSessionFromAssertion(w http.ResponseWriter, r *http.Request, assertion *saml.Assertion, redirectURI string) { |