mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
- gofumpt everything - fix TLS MinVersion to be at least 1.2 - add octal syntax - remove newlines - fix potential decompression bomb in ecjson - remove implicit memory aliasing in for loops. Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
23 lines
510 B
Go
23 lines
510 B
Go
package httputil
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
"github.com/pomerium/csrf"
|
|
)
|
|
|
|
// NewRouter returns a new router instance.
|
|
func NewRouter() *mux.Router {
|
|
return mux.NewRouter()
|
|
}
|
|
|
|
// CSRFFailureHandler sets a HTTP 403 Forbidden status and writes the
|
|
// CSRF failure reason to the response.
|
|
func CSRFFailureHandler(w http.ResponseWriter, r *http.Request) error {
|
|
if err := csrf.FailureReason(r); err != nil {
|
|
return NewError(http.StatusBadRequest, csrf.FailureReason(r))
|
|
}
|
|
return nil
|
|
}
|