(ctx context.Context)
| 2184 | } |
| 2185 | |
| 2186 | func hasPoormansAuth(ctx context.Context) error { |
| 2187 | if worker.Config.AuthToken == "" { |
| 2188 | return nil |
| 2189 | } |
| 2190 | md, ok := metadata.FromIncomingContext(ctx) |
| 2191 | if !ok { |
| 2192 | return errNoAuth |
| 2193 | } |
| 2194 | tokens := md.Get("auth-token") |
| 2195 | if len(tokens) == 0 { |
| 2196 | return errNoAuth |
| 2197 | } |
| 2198 | if subtle.ConstantTimeCompare([]byte(tokens[0]), []byte(worker.Config.AuthToken)) != 1 { |
| 2199 | return errors.Errorf("Provided auth token [%s] does not match. Permission denied.", tokens[0]) |
| 2200 | } |
| 2201 | return nil |
| 2202 | } |
| 2203 | |
| 2204 | // ParseMutationObject tries to consolidate fields of the api.Mutation into the |
| 2205 | // corresponding field of the returned dql.Mutation. For example, the 3 fields, |
no test coverage detected