internal/worker: use TenantChannelMiddleware
This commit is contained in:
parent
06038b2af6
commit
9594156baf
2 changed files with 8 additions and 2 deletions
|
|
@ -176,6 +176,7 @@ func runNextJob(t *testing.T, jobs []uuid.UUID, workerHandler http.Handler, orgI
|
||||||
Method: http.MethodPatch,
|
Method: http.MethodPatch,
|
||||||
Path: job.Location,
|
Path: job.Location,
|
||||||
RequestBody: test.JSONRequestBody(`{"result": {"job_result":{}}}`),
|
RequestBody: test.JSONRequestBody(`{"result": {"job_result":{}}}`),
|
||||||
|
Context: reqContext(orgID),
|
||||||
ExpectedStatus: http.StatusOK,
|
ExpectedStatus: http.StatusOK,
|
||||||
}.Do(t)
|
}.Do(t)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,13 @@ func (s *Server) Handler() http.Handler {
|
||||||
server: s,
|
server: s,
|
||||||
}
|
}
|
||||||
|
|
||||||
statusMW := prometheus.StatusMiddleware(prometheus.WorkerSubsystem)
|
mws := []echo.MiddlewareFunc{
|
||||||
api.RegisterHandlers(e.Group(api.BasePath, statusMW), &handler)
|
prometheus.StatusMiddleware(prometheus.WorkerSubsystem),
|
||||||
|
}
|
||||||
|
if s.config.JWTEnabled {
|
||||||
|
mws = append(mws, auth.TenantChannelMiddleware(s.config.TenantProviderFields, api.HTTPError(api.ErrorTenantNotFound)))
|
||||||
|
}
|
||||||
|
api.RegisterHandlers(e.Group(api.BasePath, mws...), &handler)
|
||||||
|
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue