From 8d3275817be294ae1d6dda91120057c962322ed4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 5 Jun 2022 18:51:01 +0200 Subject: [PATCH] providers/ldap: fix existing binder not being carried forward correctly Signed-off-by: Jens Langhammer --- internal/outpost/ldap/refresh.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/outpost/ldap/refresh.go b/internal/outpost/ldap/refresh.go index 329e973b7..57fc60e3f 100644 --- a/internal/outpost/ldap/refresh.go +++ b/internal/outpost/ldap/refresh.go @@ -10,6 +10,7 @@ import ( "github.com/go-openapi/strfmt" log "github.com/sirupsen/logrus" "goauthentik.io/api/v3" + "goauthentik.io/internal/outpost/ldap/bind" directbind "goauthentik.io/internal/outpost/ldap/bind/direct" memorybind "goauthentik.io/internal/outpost/ldap/bind/memory" "goauthentik.io/internal/outpost/ldap/constants" @@ -83,7 +84,11 @@ func (ls *LDAPServer) Refresh() error { providers[idx].searcher = directsearch.NewDirectSearcher(providers[idx]) } if *provider.BindMode.Ptr() == api.LDAPAPIACCESSMODE_CACHED { - providers[idx].binder = memorybind.NewSessionBinder(providers[idx], providers[idx].binder) + var oldBinder bind.Binder + if existing != nil { + oldBinder = existing.binder + } + providers[idx].binder = memorybind.NewSessionBinder(providers[idx], oldBinder) } else if *provider.BindMode.Ptr() == api.LDAPAPIACCESSMODE_DIRECT { providers[idx].binder = directbind.NewDirectBinder(providers[idx]) }