providers/ldap: fix existing binder not being carried forward correctly

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-06-05 18:51:01 +02:00
parent ca40d31dac
commit 8d3275817b
1 changed files with 6 additions and 1 deletions

View File

@ -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])
}