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

Function DefaultOnError

samlsp/error.go:17–25  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

15// an message via the standard log package and returns a simple text
16// "Forbidden" message to the user.
17func 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}

Callers

nothing calls this directly

Calls 2

PrintfMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected