> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LdapConfig

> atoti.LdapConfig(\
>
>     \*,\
>
>     *username\_case\_conversion*: 'upper' | 'lower' | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *url*: [str](https://docs.python.org/3/builtins/stdtypes.html#str),\
>
>     *base\_dn*: [str](https://docs.python.org/3/builtins/stdtypes.html#str),\
>
>     *manager\_dn*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *manager\_password*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *user\_search\_filter*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = `'(uid={0})'`,\
>
>     *user\_search\_base*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = `''`,\
>
>     *group\_search\_filter*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = `'(uniqueMember={0})'`,\
>
>     *group\_search\_base*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *group\_role\_attribute\_name*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = `'cn'`,\
>
> )

The config to delegate authentication to an [LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) provider.

The user’s roles can be defined using [`atoti.security.Security.ldap`](./atoti.security.Security.ldap#atoti.security.Security.ldap) and [`individual_roles`](./atoti.security.Security.individual_roles#atoti.security.Security.individual_roles).

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> config = tt.LdapConfig(
...     url="ldap://example.com:389",
...     base_dn="dc=example,dc=com",
...     user_search_base="ou=people",
...     group_search_base="ou=roles",
...     username_case_conversion="lower",
... )
```

### Attributes

#### *url*

The LDAP URL including the protocol and port.

#### *base\_dn*

The base Distinguished Name of the directory service.

#### *manager\_dn*

The Distinguished Name (DN) used to log into the Directory Service and to search for user accounts.

If `None`, the connection to the service will be done anonymously.

#### *manager\_password*

The password for the manager account specified in the *manager\_dn* attribute.

#### *user\_search\_filter*

The filter to search for users.

The substituted parameter is the user’s login name.

#### *username\_case\_conversion*

The case conversion applied to the username of a user when they authenticate through this provider.

This provider is generally case insensitive: A user named Alex can log in as `"alex"`, `"Alex"`, or `"ALEX"`.
[`individual_roles`](./atoti.security.Security.individual_roles#atoti.security.Security.individual_roles) and other username-keyed mappings are case sensitive though, so each spelling is a different user and Alex is denied their roles unless they log in with the exact spelling these roles are registered under.
A conversion collapses all the spellings into one: with `session.security.individual_roles == {"alex": {"ROLE_USER"}}`, set [`username_case_conversion`](#atoti.LdapConfig.username_case_conversion) to `"lower"`.

> [!NOTE]
>
> Added in version 6.2.1: `None` keeps the username’s case unchanged.

#### *user\_search\_base*

Search base for user searches.

#### *group\_search\_filter*

The filter to search for groups.

The substituted parameter is the DN of the user.

#### *group\_search\_base*

The search base for group membership searches.

#### *group\_role\_attribute\_name*

The attribute name that maps a group to a role.
