MCPcopy
hub / github.com/dgraph-io/dgraph / hasPoormansAuth

Function hasPoormansAuth

dgraph/cmd/alpha/admin.go:27–33  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
27func 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
35func allowedMethodsHandler(allowedMethods allowedMethods, next http.Handler) http.Handler {
36 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers 1

adminAuthHandlerFunction · 0.70

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected