mirror of
https://github.com/goauthentik/authentik
synced 2026-04-25 17:15:26 +02:00
providers/ldap: inherit adjustable page size for LDAP searchers (#21377)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@@ -16,6 +16,7 @@ type Config struct {
|
|||||||
Listen ListenConfig `yaml:"listen" env:", prefix=AUTHENTIK_LISTEN__"`
|
Listen ListenConfig `yaml:"listen" env:", prefix=AUTHENTIK_LISTEN__"`
|
||||||
Web WebConfig `yaml:"web" env:", prefix=AUTHENTIK_WEB__"`
|
Web WebConfig `yaml:"web" env:", prefix=AUTHENTIK_WEB__"`
|
||||||
Log LogConfig `yaml:"log" env:", prefix=AUTHENTIK_LOG__"`
|
Log LogConfig `yaml:"log" env:", prefix=AUTHENTIK_LOG__"`
|
||||||
|
LDAP LDAPConfig `yaml:"ldap" env:", prefix=AUTHENTIK_LDAP__"`
|
||||||
|
|
||||||
// Outpost specific config
|
// Outpost specific config
|
||||||
// These are only relevant for proxy/ldap outposts, and cannot be set via YAML
|
// These are only relevant for proxy/ldap outposts, and cannot be set via YAML
|
||||||
@@ -114,3 +115,7 @@ type WebConfig struct {
|
|||||||
type LogConfig struct {
|
type LogConfig struct {
|
||||||
HttpHeaders []string `yaml:"http_headers" env:"HTTP_HEADERS, overwrite"`
|
HttpHeaders []string `yaml:"http_headers" env:"HTTP_HEADERS, overwrite"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type LDAPConfig struct {
|
||||||
|
PageSize int `yaml:"page_size" env:"PAGE_SIZE, overwrite"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"beryju.io/ldap"
|
"beryju.io/ldap"
|
||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"goauthentik.io/internal/config"
|
||||||
"goauthentik.io/internal/outpost/ak"
|
"goauthentik.io/internal/outpost/ak"
|
||||||
"goauthentik.io/internal/outpost/ldap/constants"
|
"goauthentik.io/internal/outpost/ldap/constants"
|
||||||
"goauthentik.io/internal/outpost/ldap/group"
|
"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{
|
u, err := ak.Paginator(searchReq, ak.PaginatorOptions{
|
||||||
PageSize: 100,
|
PageSize: config.Get().LDAP.PageSize,
|
||||||
Logger: ds.log,
|
Logger: ds.log,
|
||||||
})
|
})
|
||||||
uapisp.Finish()
|
uapisp.Finish()
|
||||||
@@ -163,7 +164,7 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g, err := ak.Paginator(searchReq, ak.PaginatorOptions{
|
g, err := ak.Paginator(searchReq, ak.PaginatorOptions{
|
||||||
PageSize: 100,
|
PageSize: config.Get().LDAP.PageSize,
|
||||||
Logger: ds.log,
|
Logger: ds.log,
|
||||||
})
|
})
|
||||||
gapisp.Finish()
|
gapisp.Finish()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"goauthentik.io/internal/config"
|
||||||
"goauthentik.io/internal/outpost/ak"
|
"goauthentik.io/internal/outpost/ak"
|
||||||
"goauthentik.io/internal/outpost/ldap/constants"
|
"goauthentik.io/internal/outpost/ldap/constants"
|
||||||
"goauthentik.io/internal/outpost/ldap/flags"
|
"goauthentik.io/internal/outpost/ldap/flags"
|
||||||
@@ -53,12 +54,12 @@ func NewMemorySearcher(si server.LDAPServerInstance, existing search.Searcher) *
|
|||||||
func (ms *MemorySearcher) fetch() {
|
func (ms *MemorySearcher) fetch() {
|
||||||
// Error is not handled here, we get an empty/truncated list and the error is logged
|
// 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{
|
users, _ := ak.Paginator(ms.si.GetAPIClient().CoreAPI.CoreUsersList(context.TODO()).IncludeGroups(true), ak.PaginatorOptions{
|
||||||
PageSize: 100,
|
PageSize: config.Get().LDAP.PageSize,
|
||||||
Logger: ms.log,
|
Logger: ms.log,
|
||||||
})
|
})
|
||||||
ms.users = users
|
ms.users = users
|
||||||
groups, _ := ak.Paginator(ms.si.GetAPIClient().CoreAPI.CoreGroupsList(context.TODO()).IncludeUsers(true).IncludeChildren(true).IncludeParents(true), ak.PaginatorOptions{
|
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,
|
Logger: ms.log,
|
||||||
})
|
})
|
||||||
ms.groups = groups
|
ms.groups = groups
|
||||||
|
|||||||
Reference in New Issue
Block a user