pomerium/internal/httputil/router.go
Bobby DeSimone ba14ea246d
*: remove import path comments (#545)
- import path comments are obsoleted by the go.mod file's module statement

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-03-16 10:13:47 -07:00

22 lines
509 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
}