Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IsAuthorized = func(endpoint func(http.ResponseWriter, *http.Request)) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Header["Token"] != nil { validToken, err := validateToken(w, r) if err != nil { fmt.Fprint(w, err.Error()) } if validToken { endpoint(w, r) } } else { fmt.Fprintf(w, "No Authorization Token provided") } }) }
IsAuthorized is the middleware function to check if the request is authorized
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.