MCPcopy Create free account
hub / github.com/netlify/gotrue / extractOperatorRequest

Method extractOperatorRequest

api/middleware.go:158–167  ·  view source on GitHub ↗
(w http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

156}
157
158func (a *API) extractOperatorRequest(w http.ResponseWriter, req *http.Request) (context.Context, string, error) {
159 token, err := a.extractBearerToken(w, req)
160 if err != nil {
161 return nil, token, err
162 }
163 if token == "" || token != a.config.OperatorToken {
164 return nil, token, unauthorizedError("Request does not include an Operator token")
165 }
166 return withAdminUser(req.Context(), &models.User{ID: uuid.Nil, Email: "operator@netlify.com"}), token, nil
167}
168
169func (a *API) requireAdminCredentials(w http.ResponseWriter, req *http.Request) (context.Context, error) {
170 c, t, err := a.extractOperatorRequest(w, req)

Callers 2

verifyOperatorRequestMethod · 0.95

Calls 3

extractBearerTokenMethod · 0.95
unauthorizedErrorFunction · 0.85
withAdminUserFunction · 0.85

Tested by

no test coverage detected