diff --git a/internal/config/struct.go b/internal/config/struct.go index f373ff2225..1708844e55 100644 --- a/internal/config/struct.go +++ b/internal/config/struct.go @@ -16,6 +16,7 @@ type Config struct { Listen ListenConfig `yaml:"listen" env:", prefix=AUTHENTIK_LISTEN__"` Web WebConfig `yaml:"web" env:", prefix=AUTHENTIK_WEB__"` Log LogConfig `yaml:"log" env:", prefix=AUTHENTIK_LOG__"` + LDAP LDAPConfig `yaml:"ldap" env:", prefix=AUTHENTIK_LDAP__"` // Outpost specific config // These are only relevant for proxy/ldap outposts, and cannot be set via YAML @@ -114,3 +115,7 @@ type WebConfig struct { type LogConfig struct { HttpHeaders []string `yaml:"http_headers" env:"HTTP_HEADERS, overwrite"` } + +type LDAPConfig struct { + PageSize int `yaml:"page_size" env:"PAGE_SIZE, overwrite"` +} diff --git a/internal/outpost/ldap/search/direct/direct.go b/internal/outpost/ldap/search/direct/direct.go index f426e96a1c..f350e8820c 100644 --- a/internal/outpost/ldap/search/direct/direct.go +++ b/internal/outpost/ldap/search/direct/direct.go @@ -11,6 +11,7 @@ import ( "beryju.io/ldap" "github.com/getsentry/sentry-go" "github.com/prometheus/client_golang/prometheus" + "goauthentik.io/internal/config" "goauthentik.io/internal/outpost/ak" "goauthentik.io/internal/outpost/ldap/constants" "goauthentik.io/internal/outpost/ldap/group" @@ -117,7 +118,7 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult, } u, err := ak.Paginator(searchReq, ak.PaginatorOptions{ - PageSize: 100, + PageSize: config.Get().LDAP.PageSize, Logger: ds.log, }) uapisp.Finish() @@ -163,7 +164,7 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult, } g, err := ak.Paginator(searchReq, ak.PaginatorOptions{ - PageSize: 100, + PageSize: config.Get().LDAP.PageSize, Logger: ds.log, }) gapisp.Finish() diff --git a/internal/outpost/ldap/search/memory/memory.go b/internal/outpost/ldap/search/memory/memory.go index 47a0212c92..7d46a66d9f 100644 --- a/internal/outpost/ldap/search/memory/memory.go +++ b/internal/outpost/ldap/search/memory/memory.go @@ -10,6 +10,7 @@ import ( "github.com/getsentry/sentry-go" "github.com/prometheus/client_golang/prometheus" log "github.com/sirupsen/logrus" + "goauthentik.io/internal/config" "goauthentik.io/internal/outpost/ak" "goauthentik.io/internal/outpost/ldap/constants" "goauthentik.io/internal/outpost/ldap/flags" @@ -53,12 +54,12 @@ func NewMemorySearcher(si server.LDAPServerInstance, existing search.Searcher) * func (ms *MemorySearcher) fetch() { // Error is not handled here, we get an empty/truncated list and the error is logged users, _ := ak.Paginator(ms.si.GetAPIClient().CoreAPI.CoreUsersList(context.TODO()).IncludeGroups(true), ak.PaginatorOptions{ - PageSize: 100, + PageSize: config.Get().LDAP.PageSize, Logger: ms.log, }) ms.users = users groups, _ := ak.Paginator(ms.si.GetAPIClient().CoreAPI.CoreGroupsList(context.TODO()).IncludeUsers(true).IncludeChildren(true).IncludeParents(true), ak.PaginatorOptions{ - PageSize: 100, + PageSize: config.Get().LDAP.PageSize, Logger: ms.log, }) ms.groups = groups