Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

SAML bindings

A SAML message can reach the other side in a redirect, in an auto-submitted form, or by reference over a direct connection. Each binding encodes and signs the message differently, and reading one means knowing which binding carried it.

One message, several ways to carry it

In How SAML sign-in works, Avery's sign-in request reached Cedar Inc. inside a redirect, and the response came back inside a form that submitted itself. Both were XML documents, yet neither traveled as an XML file. SAML separates what a message says from how it is carried. The carrying rules are called bindings, and the SAML Bindings specification defines several, each named by a URN:

BindingURNTypical use
HTTP-Redirecturn:oasis:names:tc:SAML:2.0:bindings:HTTP-RedirectShort messages such as an AuthnRequest or a LogoutRequest, in a URL
HTTP-POSTurn:oasis:names:tc:SAML:2.0:bindings:HTTP-POSTLarge messages such as a signed Response, in an HTML form
HTTP-Artifacturn:oasis:names:tc:SAML:2.0:bindings:HTTP-ArtifactA short reference through the browser, with the message fetched directly
SOAPurn:oasis:names:tc:SAML:2.0:bindings:SOAPServer-to-server exchanges such as resolving an artifact or logout

The first three use the front channel: the message travels through the person's browser, as redirects and form posts. The browser can see and alter everything it carries, so these messages must protect themselves. SOAP uses the back channel, a direct HTTPS connection between the two servers, which the browser never touches. The binding matters because it decides how a message is encoded, how big it can be, and, most importantly, how it is signed.

The AuthnRequest

Here is the training service's sign-in request in full, before any encoding:

xml
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="_a7f3c2e91b0d"
    Version="2.0"
    IssueInstant="2026-10-12T08:59:58Z"
    Destination="https://login.cedar.example/saml/sso"
    AssertionConsumerServiceURL="https://training.example/saml/acs"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST">
  <saml:Issuer>https://training.example/saml</saml:Issuer>
  <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
      AllowCreate="true"/>
</samlp:AuthnRequest>

ID is a unique value for this request. The training service saves it, and Cedar Inc. will copy it into the response's InResponseTo so the two can be matched. IssueInstant is when the request was made, in UTC. Destination is the address the request is being sent to; Cedar Inc. checks that it is its own, so a request captured on its way to another identity provider cannot be replayed here.

AssertionConsumerServiceURL and ProtocolBinding say where and how the response should come back. Cedar Inc. accepts them only if the training service's metadata lists that exact address with that binding; an SP may instead send AssertionConsumerServiceIndex, which picks one of its registered endpoints by number. Issuer names the requester by its entity ID. NameIDPolicy asks for a persistent identifier and allows Cedar Inc. to create one if Avery has none for this service yet, a choice NameID and attributes explains.

HTTP-Redirect and its signature

The training service sends the request with the HTTP-Redirect binding. It compresses the XML with raw DEFLATE, a common compression format, encodes the bytes in base64 and then URL-encodes the result, both encodings from Encoding and hashing, as the SAMLRequest query parameter. It may add RelayState, a short value it wants back unchanged with the response, at most 80 bytes. The browser receives a 302 and follows the Location:

http
HTTP/1.1 302 Found
Location: https://login.cedar.example/saml/sso
  ?SAMLRequest=fVLBToNAEP2Vzd4LFFNtN0CCbYwkVYlFD17MFqbtJjCLO4PWvzdQje2F68x7b96bmYh0U7cq7fiAz...
  &RelayState=c7f2a9
  &SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256
  &Signature=Wq1XHjB0nI4o6yZ...

The parameters are shown on separate lines and shortened for reading; in the real header they form one long line. DEFLATE is there because URLs have practical length limits, often a few thousand characters, and a signed XML document would not fit. That is also why a redirect never carries a large signed Response.

A redirect cannot carry an XML signature inside the message, because signing XML adds a large block of XML. Instead the binding signs the query string. The training service builds this exact string from the URL-encoded values, in this order, leaving out RelayState if there is none:

text
SAMLRequest=fVLBToNAEP2Vzd4L...&RelayState=c7f2a9&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256

It signs those bytes with its private key, using the algorithm named in SigAlg, here RSA with SHA-256, and appends the base64 signature as Signature. To verify, Cedar Inc. rebuilds the same string from the parameters exactly as they arrived, before decoding them, because a different but equivalent URL encoding would change the bytes and break the signature. It checks the signature with the training service's certificate from its metadata, then decodes and inflates SAMLRequest and reads the XML. Cedar Inc. requires signed requests from the training service, so an unsigned request, or one signed by any other key, is refused before anyone signs in.

HTTP-POST and the auto-submitted form

The response is too large for a URL: it holds the assertion, its attributes and an XML signature. Cedar Inc. uses the HTTP-POST binding, base64-encoding the XML without DEFLATE and placing it in a hidden form field. The page it returns to Avery's browser looks like this:

html
<!doctype html>
<html>
  <body onload="document.forms[0].submit()">
    <form method="post" action="https://training.example/saml/acs">
      <input type="hidden" name="SAMLResponse" value="PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...">
      <input type="hidden" name="RelayState" value="c7f2a9">
      <noscript><button type="submit">Continue</button></noscript>
    </form>
  </body>
</html>

The script submits the form as soon as the page loads, and the button covers browsers without scripts. The action is the ACS from the agreement, never an address taken from the request without checking. In POST, signatures are ordinary XML signatures inside the message, around the Response, the Assertion or both; XML signatures and wrapping attacks explains how they work and how they fail.

The form post also has a side effect worth knowing. It is a cross-site request, from login.cedar.example to training.example, so the browser does not attach the training service's cookies that use SameSite=Lax or Strict. If the training service kept its note about the pending request in such a cookie, the note would seem to vanish at the ACS. Services either mark that one cookie SameSite=None; Secure or look the pending request up another way, without loosening their ordinary session cookie.

A signed request out by HTTP-Redirect and the response back by HTTP-POST, with the artifact alternative, where only a reference crosses the browser and the response is fetched over the back channel.

Artifact and back channels

The HTTP-Artifact binding keeps the message itself out of the browser. Cedar Inc. stores the response and sends the browser to the ACS with only a short, random reference, the artifact, in a SAMLart parameter. The training service then connects to Cedar Inc. directly and asks for the message with an ArtifactResolve request over SOAP, authenticated with a signature or a TLS client certificate. Cedar Inc. returns the response in an ArtifactResponse and deletes it, so each artifact works once.

Because the assertion never crosses the browser, it cannot be read or copied there, and it can be large. The cost is that the training service must be able to reach Cedar Inc. directly, through firewalls, and Cedar Inc. must store pending responses for a short time. Artifact is common in government and higher-education federations and rarer elsewhere.

SOAP is also used on its own for back-channel logout and attribute queries. A back-channel logout reaches an application even if Avery's browser has already closed, which matters in Single logout.

Choosing and registering bindings

Each endpoint in metadata names its binding and its location together:

xml
<md:SingleSignOnService
    Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
    Location="https://login.cedar.example/saml/sso"/>
<md:AssertionConsumerService index="0" isDefault="true"
    Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    Location="https://training.example/saml/acs"/>

The pair is the unit of agreement. Cedar Inc. sends a response only to an ACS location the training service registered, and only with the binding registered for it; the training service accepts responses only at that endpoint and only in that form. An endpoint that accepts every binding, or a response sent wherever a request asks, widens what an attacker can try for no benefit.

Most deployments settle on the same pair Avery's sign-in used: a signed AuthnRequest by redirect and a signed Response by POST. Whatever the choice, the binding only carries the message.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Cedar Inc. receives a signed AuthnRequest by HTTP-Redirect. What exactly does it verify the Signature parameter against? 1 of 3

Choose one answer.

After switching to a SameSite=Lax cookie for its pending sign-in requests, the training service finds that cookie missing at its ACS. Why? 2 of 3

Choose one answer.

A federation wants assertions never to pass through the person's browser at all. Which binding fits, and what does it require? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity