Skip to content

Interview PrepEnterprise SSO · Core

SAML Basics ​

112. What is Security Assertion Markup Language (SAML), and what problem does it solve? ​

The short answer

SAML 2.0 is an XML-based standard, from 2005, that lets an identity provider tell a separate web application, the service provider, that a user has logged in, along with facts about them, in a digitally signed message called an assertion. It solved web single sign-on across different companies' domains: an employee logs in once at their company's IdP and gets into Salesforce, Workday or a partner portal without separate passwords. It is still the most widely supported enterprise SSO protocol.

The problem before SAML. Browsers will not share cookies between acme.example and salesforce.com. So a company had no standard way to say to an outside app, "this person is our employee, already logged in". Every app needed its own password. SAML gave both sides a common, signed message format and a set of ways to pass it through the user's browser.

113. Explain the main components in SAML architecture? ​

The short answer

SAML has four building blocks. Assertions are the signed XML statements about the user. Protocols are the request and response messages, such as AuthnRequest, Response and LogoutRequest. Bindings are how those messages travel over HTTP, such as HTTP Redirect or HTTP POST. Profiles combine the other three for a use case; the Web Browser SSO profile is the one everyone means by "SAML login". The parties are the user, the identity provider and the service provider, which trust each other through exchanged metadata and certificates.

profile: Web Browser SSObindings: HTTP Redirect, HTTP POSTprotocol messages: AuthnRequest, Responseassertionsubject · conditions · authentication statement · attributes
Each layer wraps the next. The assertion is the content. A protocol message carries it. A binding says how that message travels in HTTP. A profile says which messages and bindings to use for one scenario, such as browser login.
PartExample
Identity provider (IdP)Microsoft Entra ID, Okta, ADFS
Service provider (SP)Salesforce, your SaaS app
Assertion"This is asha@acme.example, authenticated with MFA at 10:02"
Protocol messageAuthnRequest from SP, Response from IdP
BindingHTTP Redirect for the request, HTTP POST for the response
MetadataXML describing each side's endpoints and certificates

114. What is a SAML assertion? ​

The short answer

A SAML assertion is an XML document, signed by the identity provider, that makes statements about a user: who they are, when and how they authenticated, and attributes such as email, name and groups. It also states who it is for, the SP's entity ID, and a short validity window. The SP trusts the statements only after checking the signature with the IdP's certificate and checking those conditions. It plays the same role as an ID token in OIDC.

xml
<saml:Assertion ID="_a75adf55" IssueInstant="2026-10-27T10:02:00Z" Version="2.0">
  <saml:Issuer>https://sts.acme.example/</saml:Issuer>
  <ds:Signature>…</ds:Signature>
  <saml:Subject>
    <saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">asha@acme.example</saml:NameID>
    <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
      <saml:SubjectConfirmationData InResponseTo="_req7781" NotOnOrAfter="2026-10-27T10:07:00Z"
        Recipient="https://app.example/saml/acs"/>
    </saml:SubjectConfirmation>
  </saml:Subject>
  <saml:Conditions NotBefore="2026-10-27T10:01:30Z" NotOnOrAfter="2026-10-27T10:07:00Z">
    <saml:AudienceRestriction><saml:Audience>https://app.example/saml</saml:Audience></saml:AudienceRestriction>
  </saml:Conditions>
  <saml:AuthnStatement AuthnInstant="2026-10-27T10:02:00Z" SessionIndex="_s91">
    <saml:AuthnContext><saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef></saml:AuthnContext>
  </saml:AuthnStatement>
  <saml:AttributeStatement>
    <saml:Attribute Name="email"><saml:AttributeValue>asha@acme.example</saml:AttributeValue></saml:Attribute>
    <saml:Attribute Name="groups"><saml:AttributeValue>finance</saml:AttributeValue></saml:Attribute>
  </saml:AttributeStatement>
</saml:Assertion>

Reading it like the SP does: who issued it (Issuer), proof it was not changed (Signature), who it is about (NameID), which request it answers (InResponseTo), where it may be delivered (Recipient), when it is valid (NotBefore, NotOnOrAfter), who may use it (Audience), how the user logged in (AuthnStatement), and facts about them (AttributeStatement).

115. What are the parts of a SAML assertion? ​

The short answer

An assertion has: an ID and IssueInstant; the Issuer, the IdP's entity ID; a Signature over the assertion; the Subject, with a NameID identifying the user and SubjectConfirmation data saying where and until when it may be presented; Conditions, a validity window and an AudienceRestriction naming the intended SP; and one or more statements: authentication, attribute, and rarely authorization decision. Every part except the statements exists to stop the assertion being forged, reused or sent to the wrong app.

PartPurposeSP must check
IDUnique identifierNot seen before, to stop replay
IssuerWhich IdPEquals the configured IdP entity ID
SignatureIntegrity and originValid with the IdP's certificate, covering this assertion
Subject / NameIDWho the user isUse as the identity
SubjectConfirmationDataRecipient, NotOnOrAfter, InResponseToMatches our ACS URL, not expired, answers our request
ConditionsValidity window and AudienceWithin the window; audience is our entity ID
StatementsAuthentication and attributesRead only after all checks above pass

116. What are the Subject, Attribute, Authentication, and Authorization statements in SAML? ​

The short answer

The Subject identifies who all the statements are about, using a NameID. An authentication statement says the subject logged in at a certain time, by a certain method such as password or MFA, and gives a SessionIndex for logout. An attribute statement lists facts about the subject, such as email, department and group membership. An authorization decision statement says whether the subject may perform an action on a resource; it is defined in the standard but rarely used, because apps make their own authorization decisions.

ElementAnswersExample
SubjectAbout whom?NameID asha@acme.example
Authentication statementLogged in when and how?AuthnInstant 10:02, method MFA
Attribute statementWhat do we know about them?email, department=Finance, groups=finance
Authorization decision statementMay they do X on Y?Rare; apps decide this themselves

NameID formats matter. emailAddress is readable but changes when the email changes. persistent is an opaque, stable ID per SP, the SAML equivalent of OIDC's sub. Prefer persistent, or a stable attribute such as the directory's immutable object ID, as the key you link accounts by.

117. What is a SAML artifact? ​

The short answer

A SAML artifact is a short reference number sent through the browser instead of the assertion itself. The SP receives the artifact, then calls the IdP's artifact resolution service directly, server to server, over SOAP with mutual authentication, to fetch the real assertion. This keeps the assertion out of the browser entirely, which helps when it is large or confidential. It is the same idea as OAuth's authorization code. It is rarely used today, because it needs a direct back-channel connection between the SP and the IdP.

HTTP POST bindingHTTP Artifact binding
Browser carriesThe whole signed assertionA short reference
Extra callNoneSP calls the IdP's artifact service
Assertion visible to the user's browserYesNo
Needs SP to reach IdP directlyNoYes
Usage todayVery commonRare

118. What is the Assertion Consumer Service (ACS) URL? ​

The short answer

The ACS URL is the endpoint on the service provider that receives the SAML response from the IdP, for example https://app.example/saml/acs. The IdP sends the response there, usually by making the browser auto-submit a form POST. The SP registers its ACS URL with the IdP in advance, and the IdP must only send responses to registered URLs. The SP must check that the assertion's Recipient and the response's Destination equal its own ACS URL, so an assertion meant for another app cannot be replayed to it.

What the IdP sends to the browser to deliver the response:

html
<form method="post" action="https://app.example/saml/acs">
  <input type="hidden" name="SAMLResponse" value="PHNhbWxwOlJlc3BvbnNlIC4uLg==" />
  <input type="hidden" name="RelayState" value="/reports/q3" />
</form>
<script>document.forms[0].submit()</script>

Reading it: SAMLResponse is the Base64-encoded XML response. RelayState carries the page the user originally wanted, so the SP can send them there after login. Validate RelayState as a local path, or it becomes an open redirect.

The ACS endpoint and SameSite. This is a cross-site POST from the IdP's domain. A SameSite=Lax or Strict cookie set before login is not sent with it. So the SP must not depend on a pre-login cookie arriving at the ACS, or it must set that cookie with SameSite=None; Secure. This is a common cause of "SAML works in one browser but not another" (SameSite values).

119. What is SAML metadata XML, and what information does it contain? ​

The short answer

Metadata is an XML document each side publishes to describe itself, so they can be configured to trust each other without typing details by hand. It contains the entity ID, the unique name of the IdP or SP; the endpoints, such as the IdP's SSO and logout URLs or the SP's ACS URL, each with its binding; the certificates used for signing and encryption; the supported NameID formats; and contact and organisation details. Often it is exchanged as a URL that each side fetches, so certificate changes are picked up automatically.

xml
<EntityDescriptor entityID="https://sts.acme.example/" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">
  <IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
    <KeyDescriptor use="signing">
      <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><X509Data><X509Certificate>MIIC8D…</X509Certificate></X509Data></KeyInfo>
    </KeyDescriptor>
    <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://sts.acme.example/saml2"/>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://sts.acme.example/saml2/logout"/>
  </IDPSSODescriptor>
</EntityDescriptor>
ElementMeaning
entityIDThe IdP's unique name; must match Issuer in assertions
KeyDescriptor use="signing"The certificate whose key signs assertions
SingleSignOnServiceWhere the SP sends login requests
SingleLogoutServiceWhere to send logout messages
SP metadata AssertionConsumerServiceThe SP's ACS URL

120. What are SAML bindings? ​

The short answer

A binding defines how a SAML message is carried inside HTTP. HTTP Redirect puts a compressed, Base64-encoded message in a URL query parameter; it suits short messages such as an AuthnRequest. HTTP POST puts the Base64-encoded message in a hidden form field that the browser auto-submits; it suits large signed responses. HTTP Artifact sends only a reference and fetches the message over a back channel. SOAP is used for direct server-to-server calls, such as artifact resolution and some logout flows.

BindingMessage travels inSize limitTypical use
HTTP RedirectURL query, ?SAMLRequest=…URL length, a few KBAuthnRequest, LogoutRequest
HTTP POSTAuto-submitted form bodyLargeResponse with the assertion
HTTP ArtifactA reference, resolved by SOAPNot applicableHiding the assertion from the browser
SOAPDirect HTTP between serversLargeArtifact resolution, back-channel logout

121. What is the difference between HTTP Redirect and HTTP POST bindings? ​

The short answer

With HTTP Redirect, the message is DEFLATE-compressed, Base64-encoded and put in the URL as SAMLRequest or SAMLResponse, and any signature is sent as separate SigAlg and Signature URL parameters. It is limited by URL length, so it is used for small requests. With HTTP POST, the message is Base64-encoded, not compressed, into a hidden form field and submitted by the browser, and any signature is embedded inside the XML. It handles large signed assertions, so responses almost always use POST.

HTTP RedirectHTTP POST
Carried inURL query stringForm body
EncodingDEFLATE, then Base64, then URL-encodeBase64
SignatureSeparate URL parametersInside the XML
SizeSmall, about 2 KB to 8 KBLarge
Appears in logs and historyYesNo
Typical messageAuthnRequestResponse

Why signatures differ. URL-based messages can be re-encoded by browsers and proxies, which would break an XML signature inside them. So the Redirect binding signs the exact query string bytes instead.

122. What is the difference between IdP-initiated and SP-initiated SAML login? ​

The short answer

In SP-initiated login, the user starts at the app. The app sends an AuthnRequest to the IdP, the user logs in, and the IdP posts back a response that references that request with InResponseTo. In IdP-initiated login, the user starts at the IdP's portal, such as the Microsoft My Apps page, clicks an app tile, and the IdP sends an unsolicited response to the app's ACS URL with no request behind it. Both deliver the same kind of assertion, but IdP-initiated loses the link to a specific request.

SP-initiated① user opensthe app② AuthnRequestID=_req7781③ IdPlogin④ Response to ACSInResponseTo=_req7781IdP-initiated① user clicks an app tilein the IdP portal② unsolicited Response to ACSno InResponseTo
The difference is the request ID. In SP-initiated login the app can check that the response answers a request it really sent, from this browser. In IdP-initiated login there was no request, so the app cannot tell a fresh response from one an attacker captured and replayed or injected.

123. Which SAML initiation flow is generally preferable, and why? ​

The short answer

SP-initiated is preferable. The SP can tie the response to a request it made from this browser, by checking InResponseTo, and that closes off replay and login CSRF attacks, where an attacker forces a victim's browser to log in as the attacker. It also returns the user to the page they wanted through RelayState, and works when users go straight to a bookmark. IdP-initiated is convenient for portal tiles, but it should be accepted only with strict checks, or turned into SP-initiated by having the tile link to the app's own login URL.

The safe way to support portal tiles. Configure the IdP tile to open https://app.example/saml/login instead of posting an assertion directly. The app then starts a normal SP-initiated login. The user sees the same one-click experience, and the app keeps the InResponseTo check.

If you must accept IdP-initiated responses:

  1. Keep the assertion lifetime very short, a few minutes.
  2. Store every assertion ID until it expires, and reject repeats.
  3. Never use RelayState from an unsolicited response as a redirect without checking it.
  4. Allow it per customer, only when they need it.

Combine chapters into one PDF

Pick the chapters you want. They print in the order you pick them.

Interview Prep
Authentication & Identity
Cookies & sessions
Authentication
Tokens
OAuth & OIDC
Enterprise SSO
Directories
Authorization
Other topics
Nothing picked yet