mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 10:08:31 -05:00
Bumps [github.com/crewjam/saml](https://github.com/crewjam/saml) from 0.4.13 to 0.4.14. - [Commits](https://github.com/crewjam/saml/compare/v0.4.13...v0.4.14) --- updated-dependencies: - dependency-name: github.com/crewjam/saml dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
26 lines
799 B
Go
26 lines
799 B
Go
package samlsp
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/crewjam/saml"
|
|
)
|
|
|
|
// ErrorFunction is a callback that is invoked to return an error to the
|
|
// web user.
|
|
type ErrorFunction func(w http.ResponseWriter, r *http.Request, err error)
|
|
|
|
// 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.
|
|
func DefaultOnError(w http.ResponseWriter, _ *http.Request, err error) {
|
|
if parseErr, ok := err.(*saml.InvalidResponseError); ok {
|
|
log.Printf("WARNING: received invalid saml response: %s (now: %s) %s",
|
|
parseErr.Response, parseErr.Now, parseErr.PrivateErr)
|
|
} else {
|
|
log.Printf("ERROR: %s", err)
|
|
}
|
|
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
|
|
}
|