LDAP
A network protocol that lets applications look up information in a shared directory, such as employee accounts and group memberships. Applications can also use it to check a user's credentials.
Also known as: Lightweight Directory Access Protocol, служба каталогов
What LDAP is
LDAP stands for Lightweight Directory Access Protocol. Think of a directory as a company address book that also tracks accounts, devices, and groups. Instead of maintaining their own copies of that information, an intranet and a help desk can both ask the same directory for it. LDAP defines how clients make those requests and how servers reply. It isn't the directory itself: Microsoft Active Directory supports LDAP, and OpenLDAP is directory server software that implements it.
How a directory is organized
A directory presents its entries as a tree. Each entry has attributes, such as an email address, and a distinguished name (DN) that identifies its location. For example, in uid=maya,ou=people,dc=example,dc=org, the uid=maya entry sits under the ou=people container. Read the DN from right to left to go from the broader namespace to the individual entry. A DN isn't necessarily what someone types as their username. The directory schema and the entry's object classes define which attributes are required or allowed.
To search, a client supplies a starting point (the base DN), a scope, a filter, and the attributes it wants back. A search can cover just the starting entry, its immediate children, or the whole subtree. LDAP also defines operations for adding, modifying, and deleting entries; the server decides which operations the client is allowed to perform.
Example: from a username to an app role
Suppose Maya signs in to a staff portal. The portal can use a read-only service account to search the people subtree with the filter (uid=maya) and require exactly one match. It can then use the returned DN and the password Maya entered in a Bind operation on a separate connection. The server checks the credentials; the portal doesn't fetch a password from the directory to compare it locally.
A successful Bind answers “Who is this user?” It doesn't answer “May this user publish reports?” The portal can look up Maya's group membership and apply its own rule, such as granting publishing rights to members of the report editors group. Don't assume that every directory uses uid for usernames or represents group membership the same way. Those details depend on the schema and configuration.
Transport security and common misconceptions
LDAP traffic isn't encrypted by default. Clients commonly either request a TLS upgrade with StartTLS on port 389 or use LDAPS, which starts TLS as soon as the connection opens, typically on port 636. Before a password-based Simple Bind, establish TLS and validate the server certificate. If that fails, stop rather than sending credentials over an unprotected connection.
A shared directory also isn't the same as single sign-on. Two apps can check the same directory password and still prompt the user separately. Single sign-on lets a user access multiple apps without signing in to each one again.
How it comes up in interviews
A common prompt is “How would you let only members of a directory group into an internal tool?” Walk through finding the account, authenticating the user, reading the relevant group membership, and enforcing the access rule. Explain why a successful search isn't proof of identity and why a successful Bind isn't proof of permission.