hasPoormansAuth checks if poorman's auth is required and if so whether the given http request has poorman's auth in it or not
(r *http.Request)
| 25 | // hasPoormansAuth checks if poorman's auth is required and if so whether the given http request has |
| 26 | // poorman's auth in it or not |
| 27 | func hasPoormansAuth(r *http.Request) bool { |
| 28 | if worker.Config.AuthToken != "" && subtle.ConstantTimeCompare( |
| 29 | []byte(worker.Config.AuthToken), []byte(r.Header.Get("X-Dgraph-AuthToken"))) != 1 { |
| 30 | return false |
| 31 | } |
| 32 | return true |
| 33 | } |
| 34 | |
| 35 | func allowedMethodsHandler(allowedMethods allowedMethods, next http.Handler) http.Handler { |
| 36 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |