> ## 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

<span id="atoti.LdapConfig" />

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

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/0.9/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

<h4 id="atoti.LdapConfig.url">
  *url*
</h4>

The LDAP URL including the protocol and port.

<h4 id="atoti.LdapConfig.base_dn">
  *base\_dn*
</h4>

The base Distinguished Name of the directory service.

<h4 id="atoti.LdapConfig.manager_dn">
  *manager\_dn*
</h4>

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.

<h4 id="atoti.LdapConfig.manager_password">
  *manager\_password*
</h4>

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

<h4 id="atoti.LdapConfig.user_search_filter">
  *user\_search\_filter*
</h4>

The filter to search for users.

The substituted parameter is the user’s login name.

<h4 id="atoti.LdapConfig.username_case_conversion">
  *username\_case\_conversion*
</h4>

The case conversion to apply to the username.

This authentication provider is generally case insensitive: the same user **Jane** could log in with the usernames `"jane"`, `"Jane"`, `"JANE"`, etc.
This attribute allows reducing all the possible cases to a single one to be compatible with [`individual_roles`](./atoti.security.Security.individual_roles#atoti.security.Security.individual_roles) and other case sensitive mappings.

For instance, if `session.security.individual_roles == {"jane": {"ROLE_USER"}}`, [`username_case_conversion`](#atoti.LdapConfig.username_case_conversion) should be set to `"lower"`.

<h4 id="atoti.LdapConfig.user_search_base">
  *user\_search\_base*
</h4>

Search base for user searches.

<h4 id="atoti.LdapConfig.group_search_filter">
  *group\_search\_filter*
</h4>

The filter to search for groups.

The substituted parameter is the DN of the user.

<h4 id="atoti.LdapConfig.group_search_base">
  *group\_search\_base*
</h4>

The search base for group membership searches.

<h4 id="atoti.LdapConfig.group_role_attribute_name">
  *group\_role\_attribute\_name*
</h4>

The attribute name that maps a group to a role.
