DefaultOnError is the default ErrorFunction implementation. It prints an message via the standard log package and returns a simple text "Forbidden" message to the user.
(w http.ResponseWriter, r *http.Request, err error)
| 15 | // an message via the standard log package and returns a simple text |
| 16 | // "Forbidden" message to the user. |
| 17 | func DefaultOnError(w http.ResponseWriter, r *http.Request, err error) { |
| 18 | if parseErr, ok := err.(*saml.InvalidResponseError); ok { |
| 19 | log.Printf("WARNING: received invalid saml response: %s (now: %s) %s", |
| 20 | parseErr.Response, parseErr.Now, parseErr.PrivateErr) |
| 21 | } else { |
| 22 | log.Printf("ERROR: %s", err) |
| 23 | } |
| 24 | http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) |
| 25 | } |