SAML bindings
A SAMLThe Security Assertion Markup Language, a federation standard widely used for workplace single sign-on, in which the identity provider sends the application a signed assertion about the user. 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:
| Binding | URN | Typical use |
|---|---|---|
| HTTP-Redirect | urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect | Short messages such as an AuthnRequest or a LogoutRequest, in a URL |
| HTTP-POST | urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST | Large messages such as a signed Response, in an HTML form |
| HTTP-Artifact | urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact | A short reference through the browser, with the message fetched directly |
| SOAP | urn:oasis:names:tc:SAML:2.0:bindings:SOAP | Server-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 HTTPSHTTP protected by TLS, so traffic is encrypted and checked for changes while it travels. It protects the connection, but does not prove that the site at the other end is honest. 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:
<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 providerA service that authenticates users and tells other applications about the sign-in, so those applications never handle the users' passwords. In OpenID Connect it is called an OpenID 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 SPSAML's name for the application that relies on an identity provider's sign-in, which OpenID Connect calls a relying party. In SCIM, the same term means the application that stores the accounts. 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 base64A way of encoding data as ordinary text characters so it can travel safely in headers, URLs, and JSON. Anyone can decode it, so it hides nothing; Base64url is a variant safe for URLs, used in JWTs. 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/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 signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. 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:
SAMLRequest=fVLBToNAEP2Vzd4L...&RelayState=c7f2a9&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256It signs those bytes with its private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner., 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 encodingWriting a character as % followed by a two-character code, such as %2F for /, so a value inside an address or form body is not mistaken for part of its structure. The receiving service decodes it before use. would change the bytes and break the signature. It checks the signature with the training service's certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name. 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 URLA web address, such as https://photos.example/api/albums/42?limit=10. It names how to connect (https), the domain, the path to a particular page or resource, and any extra parameters after the question mark.: 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:
<!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 ACSThe endpoint at a SAML service provider that receives the identity provider's response, usually as a form the browser posts. The service provider publishes its ACS URL in metadata, and the identity provider sends responses only there. 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 cookieA small value that a website asks the browser to store and send back with later matching requests. Cookies commonly carry a session identifier, so the site can recognize an ongoing sign-in without your password., 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.
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:
<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.
Try it in the Lab
- Decode a signed redirect and a posted response, and verify the redirect signature yourselfCapture the AuthnRequest your browser carries by HTTP-Redirect and the response it posts back, and check the query-string signature yourself with openssl.