An XML-based way for a company login to sign users in to other apps.
SAML (Security Assertion Markup Language) lets a company login system tell other apps who a user is, using a signed XML message. The user signs in once, and many apps trust the answer.
Big companies use dozens of apps: email, HR, finance, ticketing. They do not want a separate password in each one. With SAML single sign-on, the company runs one login system (the IdP, such as Okta, Microsoft Entra ID or Active Directory Federation Services). Every app (the SP) trusts it.
The trust is built before anyone logs in. The IdP and the SP exchange metadata: an XML file with names, URLs and the public key the IdP uses to sign. Later, the SP can check that a message really came from the IdP, because only the IdP has the matching private key.
The main message is the assertion. It says things like: "This is alice@company.com. She signed in with MFA at 10:02. Her role is viewer. This statement is meant for app.example.com and is valid until 10:05." The IdP signs it, so nobody can change it.
| Part | What it is | Why it matters |
|---|---|---|
| IdP (identity provider) | The system that signs users in and issues assertions | The one source of truth about identity |
| SP (service provider) | The app that accepts the assertion | Trusts the IdP, decides what the user can do |
| Metadata | XML describing entity IDs, URLs and public keys | Sets up trust before any login |
| AuthnRequest | The app's request to sign the user in | Carries a request ID to match the answer |
| Assertion | The signed statement about the user | The core of SAML |
| ACS URL | Assertion Consumer Service: where the app receives the response | Must be exact, or an attacker could redirect it |
| Attributes | Extra facts such as email, name, groups | Mapped to the app's own user and roles |
| SAML | OAuth2 | OpenID Connect (OIDC) | |
|---|---|---|---|
| Main job | Sign users in (SSO), enterprise web apps | Let an app call an API for you (delegated access) | Sign users in, built on OAuth2 |
| Message format | XML, signed | Tokens, often JSON or opaque | JSON Web Tokens (JWT) |
| Typical clients | Browser-based enterprise apps | Web, mobile and server apps | Web, mobile and single-page apps |
| Weight | Heavier, more set-up | Lighter | Lighter |
| Age | Older, very common in enterprises | Newer | Newer, the usual choice for new apps |
A normal sign-in. The app checks four things and lets the user in.
A simplified teaching flow. Real responses are longer XML, are signed with XML signatures, and an app should use a well-tested SAML library, never hand-written parsing. The times and IDs shown are illustrative.
| Term | Meaning in easy words |
|---|---|
| SAML | Security Assertion Markup Language: an XML standard for passing identity between systems |
| IdP | Identity provider: signs users in and issues assertions |
| SP | Service provider: the app that trusts the IdP |
| Assertion | The signed XML statement about a user |
| Metadata | XML that shares entity IDs, URLs and public keys between IdP and SP |
| ACS URL | Assertion Consumer Service URL, where the SP receives the response |
| Entity ID | A unique name for an IdP or SP |
| AuthnRequest | The SP's request asking the IdP to sign the user in |
| InResponseTo | A field in the response that points to the request ID it answers |
| Audience restriction | Says which SP the assertion is meant for |
| Federation | Trust between separate organisations so their users can use each other's apps |
| Choice | We gain | We lose |
|---|---|---|
| SAML | Strong enterprise support and many existing IdPs | Heavier set-up, XML complexity |
| OIDC | Simpler JSON tokens, good for mobile and single-page apps | Some older enterprise apps cannot use it |
| SP-initiated login | Response is tied to a request (InResponseTo) | Users must start from the app |
| IdP-initiated login | Handy app tiles in the IdP portal | No request to match, easier to replay or inject |
| Short assertion lifetime | A stolen assertion is useful for a short time | Clock skew errors become more likely |
| Encrypted assertions | Hides user data from the browser and intermediaries | More keys to manage |