SAML vs LDAP: Federation vs Directory Protocol Compared
SAML carries a signed statement about a login between an identity provider and one application, across the user's browser. LDAP carries questions and answers between an application and a directory: lookups, password checks, and record changes. SAML moves proof of authentication; LDAP moves directory data.
- Different cargo. SAML transports assertions about a sign-in; LDAP transports directory queries and entries.
- Different routes. SAML assertions travel through the browser; LDAP traffic goes server to server.
- Different lifespans. A SAML assertion lives for minutes; an LDAP record lives for years.
- They chain together. The provider often verifies the user against an LDAP directory before issuing the assertion.
- Substitution is impossible. Neither protocol can do the other's job in an architecture.
What does SAML actually move?
SAML, the Security Assertion Markup Language, packages the outcome of a login into a signed XML document called an assertion. It states who the user is, when they authenticated, and selected attributes.
The assertion travels a specific route. The identity provider hands it to the user's browser, and the browser delivers it to the application, which validates the signature and starts a session.
Nothing about the user's record moves permanently. The application learns what the assertion carries and nothing more, and the assertion itself expires within minutes.
Our explainer on what is SAML diagrams the full exchange, including the metadata and certificates both sides exchange beforehand.
Attributes ride inside the assertion by agreement. Name, email, and group claims are mapped beforehand, so the application receives a curated extract, never the whole record.
The assertion is also deliberately narrow. It proves this login, for this application, at this time, which is why one assertion cannot be replayed at a second service.
What does LDAP actually move?
LDAP moves operations against a directory. A client binds to the directory server, then issues searches, comparisons, additions, modifications, and deletions against entries in a tree.
The cargo is the record itself: names, email addresses, group memberships, and the credential material used to verify a password during a bind.
Red Hat's protocol overview describes the distinguished name as the path each operation follows through the directory tree, from organization down to the individual account entry.
Unlike SAML's browser relay, LDAP is a direct conversation between machines inside the network. The end user never sees it, and usually never knows it happened.
LDAP also writes. The same protocol that searches can add a user, change a department, or delete an entry, which is why bind accounts carry such sensitive power.
Search filters are LDAP's query language in miniature. A filter on group membership can answer an authorization question in one round trip, which applications have exploited for decades.
How do SAML and LDAP compare mechanically?
| Dimension | SAML | LDAP |
|---|---|---|
| Purpose | Federate a completed login to an application | Query and manage a directory of records |
| Payload | Signed XML assertion about one sign-in | Operations and entries: users, groups, attributes |
| Path taken | Provider to browser to application | Application directly to directory server |
| Trust basis | Certificates and exchanged metadata | Bind credentials and directory access rules |
| Lifetime of the data | Minutes, then the assertion is spent | Years, for as long as the account exists |
| Typical port and transport | HTTPS through the browser | Port 389, or 636 encrypted as LDAPS |
| Answers which question | Who just proved their identity, and where? | What do we hold about this identity? |
The last row is the cleanest separator. SAML speaks in events, one login at a time. LDAP speaks in state, the standing record that events are checked against.
Encryption tells a similar story of eras. SAML signs its messages because they cross untrusted hands; LDAP relies on transport encryption, LDAPS or StartTLS, between two known machines.
How do they chain together at login?
Follow one ordinary sign-in. You open a SaaS app, get redirected to your identity provider, and enter your password there, not in the app.
Behind that page, the provider needs to verify you. In directory-backed estates it performs an LDAP bind and search against Active Directory or OpenLDAP to check the credential and pull your groups.
Only then does SAML start. The provider builds the assertion, signs it, and your browser carries it back to the application, which opens your session.
So the protocols are consecutive, not competing: LDAP answers the provider's question, SAML carries the provider's answer. Our comparison of SAML vs OAuth covers SAML's real peer group.
Troubleshoot in chain order. If users cannot log in, test the directory lookup before debugging certificates; a failed LDAP search produces a SAML error that blames the wrong layer.
Not every estate chains them. A cloud provider with its own directory skips LDAP entirely, which is why SAML alone does not tell you what sits behind the login page.
Timing exposes the chain under stress. Slow directory lookups surface as slow logins, and users report them as an SSO problem, whatever the provider's status page says.
Why do people compare SAML and LDAP?
Because vendor datasheets list both under "authentication support", which makes them look like alternative flavours of the same feature. They are not; the word authentication is doing two jobs.
In the LDAP row, authentication means the directory verifying a password presented to it. In the SAML row, it means an application accepting another system's verification.
Procurement checklists deepen the confusion. An app that supports LDAP authentication usually takes your password itself and checks the directory, a very different risk profile from SAML.
Ask the follow-up question in evaluations: does the user type a password into this app, or into our provider? The answer tells you which protocol is really in play. It belongs in every access reviews questionnaire.
The confusion has a budget consequence. Teams buy federation for applications that only support directory binds, then discover the integration section of the project plan was fiction.
What risks does each protocol carry?
SAML's risks concentrate on signatures and clocks. A mis-validated assertion or a generous time window can let forged or replayed assertions through, so implementations must check both strictly.
LDAP's risks concentrate on exposure and privilege. Plain LDAP sends data unencrypted unless LDAPS or StartTLS is used, and an over-privileged bind account turns one app compromise into directory-wide access.
The blast radii differ, too. A SAML misconfiguration usually affects one application's trust; a directory compromise affects every system that consults it.
That asymmetry explains the operational cultures. SAML work is per-application and episodic; LDAP work is central, change-controlled, and audited like the crown jewels it guards. The SAML vs OIDC comparison shows how newer federation changed the first half of that picture.
Audit trails split along the same seam. The directory logs who was looked up; the provider logs who was let in. An investigation usually needs both timelines side by side.
How do the two protocols handle errors and outages?
LDAP failures are immediate and legible. A bind is refused, a search returns nothing, and the application knows within milliseconds that the directory cannot help it.
SAML failures are more theatrical. Users bounce between application and provider, collecting errors about signatures, clocks, or expired assertions that name neither the cause nor the owner.
Outage shapes differ accordingly. A directory outage is a hard stop for everything that consults it, which is why directories run replicated and boring.
A provider outage breaks sign-in just as completely, but existing application sessions often survive it, because the assertion already did its work.
That difference drives runbooks: directory teams rehearse failover, federation teams rehearse certificate rollover, and both rehearse the call where each blames the other.
Error budgets follow the blast radius. A five-minute directory blip can fail ten thousand lookups, while a SAML misconfiguration often hurts one application at a time.
Which protocol should you prioritise?
Prioritise by the question in front of you. Connecting a new SaaS application for browser sign-in is a SAML task, assuming your provider and the app both support it.
Consolidating identity records, or wiring an on-premise system to verify users, is an LDAP task. No amount of SAML configuration will give a legacy app a directory to consult.
In practice you will fund both, in chain order: a healthy directory first, because federation built on rotten records produces rotten assertions with valid signatures.
Document the chain in your app inventory: which apps federate, which still bind directly, and which directory each path ends at. That map is the real deliverable of understanding this comparison.
Keep the vocabulary straight in tickets and diagrams. Writing that the SAML server stores your users guarantees a confused quarter; the directory stores users, SAML moves proof.
Sources
Frequently asked questions
Can SAML replace LDAP?
No. SAML federates the result of a login to an application; it stores nothing. The identity provider still needs a directory behind it, very often reached through LDAP, to verify users and read their groups.
Can an application use LDAP instead of SAML for SSO?
It can check passwords against a directory, but that is not federated SSO. The application collects the password itself, runs its own session, and sits outside central MFA and revocation controls.
Does SAML traffic pass through the browser?
Yes. The identity provider gives the signed assertion to the user's browser, which posts it to the application. LDAP, by contrast, flows directly between the application or provider and the directory server.
What port does LDAP use?
Standard LDAP uses port 389, and LDAPS, LDAP over TLS, uses port 636. SAML has no port of its own because its messages ride ordinary HTTPS through the browser.
Which protocol came first?
LDAP, by about a decade. LDAP dates from 1993 as a lightweight directory protocol, while SAML 2.0 was finalised in 2005 to federate sign-in between organizations and web applications.