(w http.ResponseWriter, req *http.Request)
| 156 | } |
| 157 | |
| 158 | func (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 | |
| 169 | func (a *API) requireAdminCredentials(w http.ResponseWriter, req *http.Request) (context.Context, error) { |
| 170 | c, t, err := a.extractOperatorRequest(w, req) |
no test coverage detected