outposts/ldap: fix contexts
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
75a720ead1
commit
b45a442447
|
@ -116,12 +116,12 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
||||||
var users *[]api.User
|
var users *[]api.User
|
||||||
var groups *[]api.Group
|
var groups *[]api.Group
|
||||||
|
|
||||||
errs, _ := errgroup.WithContext(req.Context())
|
errs, errCtx := errgroup.WithContext(req.Context())
|
||||||
|
|
||||||
if needUsers {
|
if needUsers {
|
||||||
errs.Go(func() error {
|
errs.Go(func() error {
|
||||||
if flags.CanSearch {
|
if flags.CanSearch {
|
||||||
uapisp := sentry.StartSpan(req.Context(), "authentik.providers.ldap.search.api_user")
|
uapisp := sentry.StartSpan(errCtx, "authentik.providers.ldap.search.api_user")
|
||||||
searchReq, skip := utils.ParseFilterForUser(c.CoreApi.CoreUsersList(uapisp.Context()), parsedFilter, false)
|
searchReq, skip := utils.ParseFilterForUser(c.CoreApi.CoreUsersList(uapisp.Context()), parsedFilter, false)
|
||||||
|
|
||||||
if skip {
|
if skip {
|
||||||
|
@ -140,8 +140,8 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
||||||
users = &u.Results
|
users = &u.Results
|
||||||
} else {
|
} else {
|
||||||
if flags.UserInfo == nil {
|
if flags.UserInfo == nil {
|
||||||
uapisp := sentry.StartSpan(req.Context(), "authentik.providers.ldap.search.api_user")
|
uapisp := sentry.StartSpan(errCtx, "authentik.providers.ldap.search.api_user")
|
||||||
u, _, err := c.CoreApi.CoreUsersRetrieve(req.Context(), flags.UserPk).Execute()
|
u, _, err := c.CoreApi.CoreUsersRetrieve(uapisp.Context(), flags.UserPk).Execute()
|
||||||
uapisp.Finish()
|
uapisp.Finish()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -164,7 +164,7 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
||||||
|
|
||||||
if needGroups {
|
if needGroups {
|
||||||
errs.Go(func() error {
|
errs.Go(func() error {
|
||||||
gapisp := sentry.StartSpan(req.Context(), "authentik.providers.ldap.search.api_group")
|
gapisp := sentry.StartSpan(errCtx, "authentik.providers.ldap.search.api_group")
|
||||||
searchReq, skip := utils.ParseFilterForGroup(c.CoreApi.CoreGroupsList(gapisp.Context()), parsedFilter, false)
|
searchReq, skip := utils.ParseFilterForGroup(c.CoreApi.CoreGroupsList(gapisp.Context()), parsedFilter, false)
|
||||||
if skip {
|
if skip {
|
||||||
req.Log().Trace("Skip backend request")
|
req.Log().Trace("Skip backend request")
|
||||||
|
|
Reference in New Issue