# LDAP / Active Directory Integration {#ldap--active-directory-integration}


Authenticate users against LDAP or Microsoft Active Directory.


## Overview {#overview}


LDAP integration enables:

- User authentication against corporate directory
- Auto-provisioning of user accounts
- Role mapping from LDAP groups
- Periodic sync of user attributes


## Configuration {#configuration}


```
LDAP_ENABLED=true
LDAP_URL=ldap://ldap.example.com:389
LDAP_BIND_DN=cn=admin,dc=example,dc=com
LDAP_BIND_CREDENTIALS=admin-password
LDAP_SEARCH_BASE=ou=users,dc=example,dc=com
LDAP_SEARCH_FILTER=(uid={{username}})
```


### Active Directory {#active-directory}


```
LDAP_URL=ldap://ad.example.com:389
LDAP_BIND_DN=CN=ServiceAccount,OU=ServiceAccounts,DC=corp,DC=example,DC=com
LDAP_SEARCH_BASE=OU=Employees,DC=corp,DC=example,DC=com
LDAP_SEARCH_FILTER=(sAMAccountName={{username}})
```


## Attribute Mapping {#attribute-mapping}


| LDAP Attribute    | Gauzy Field   |
| ----------------- | ------------- |
| `mail`            | email         |
| `givenName`       | firstName     |
| `sn`              | lastName      |
| `memberOf`        | role (mapped) |
| `telephoneNumber` | phone         |


## Group-to-Role Mapping {#group-to-role-mapping}


```
LDAP_ROLE_MAPPING_ADMIN=CN=GauzyAdmins,OU=Groups,DC=example,DC=com
LDAP_ROLE_MAPPING_MANAGER=CN=GauzyManagers,OU=Groups,DC=example,DC=com
LDAP_ROLE_MAPPING_EMPLOYEE=CN=GauzyUsers,OU=Groups,DC=example,DC=com
```


## Related Pages {#related-pages}


- [SSO/SAML Integration](https://sourcey-gauzy.pages.dev/integrations/sso-saml-integration/index.md) — SSO setup
- [User Management](https://sourcey-gauzy.pages.dev/admin/user-role-management/index.md) — user admin
