diff --git a/seacatauth/credentials/providers/ldap.py b/seacatauth/credentials/providers/ldap.py index 35ae1773..1d476273 100644 --- a/seacatauth/credentials/providers/ldap.py +++ b/seacatauth/credentials/providers/ldap.py @@ -54,7 +54,7 @@ class LDAPCredentialsProvider(CredentialsProviderABC): "username": "cn=admin,dc=example,dc=org", "password": "admin", "base": "dc=example,dc=org", - "filter": "(&(objectClass=inetOrgPerson)(cn=*))", + "filter": "|(objectClass=organizationalPerson)(objectClass=inetOrgPerson)", "attributes": "mail mobile userAccountControl displayName", # Path to CA file in PEM format @@ -85,7 +85,9 @@ def __init__(self, provider_id, config_section_name, proactor_svc): self.LdapUri = self.Config["uri"] self.Base = self.Config["base"] - self.Filter = self.Config["filter"] + self.Filter: str = self.Config["filter"] + if not (self.Filter.startswith("(") and self.Filter.endswith(")")): + self.Filter = "({})".format(self.Filter) self.AttrList = _prepare_attributes(self.Config) # Fields to filter by when locating a user