Course contentsShow
← Security
Lesson 777 of 3,05216. Web Security - Authentication MechanismsFree lesson

SAML Authentication Flow

How SP-initiated and IdP-initiated flows work, including redirect and POST bindings for assertion exchange.

SAML Authentication Flow

You'll learn: How SAML enables single sign-on through SP-initiated and IdP-initiated authentication flows with different assertion delivery methods.

Understanding SAML Flows

SAML authentication can begin in two ways, depending on who starts the process. Think of it like entering a building: you might approach security first (SP-initiated), or security might escort you from the entrance (IdP-initiated).

SP-Initiated Flow

The Service Provider-initiated flow starts when you try accessing a protected resource:

  1. User requests a resource from the Service Provider (SP)
  2. SP generates an AuthnRequest and redirects the user to the Identity Provider (IdP)
  3. IdP authenticates the user (login page)
  4. IdP generates a SAML assertion and sends it back to the SP
  5. SP validates the assertion and grants access

This is like showing up at a venue and being directed to check-in first.

IdP-Initiated Flow

The Identity Provider-initiated flow starts at the IdP portal:

  1. User logs into the IdP portal directly
  2. User selects an application to access
  3. IdP generates a SAML assertion without receiving a request
  4. IdP sends the assertion directly to the SP
  5. SP validates and grants access

This is like checking in at a hotel desk, then being escorted to your room without asking.

Assertion Bindings

SAML uses two primary methods to exchange assertions:

HTTP Redirect Binding: The assertion is encoded in the URL query string (Base64 + URL-encoded). Limited by URL length but doesn't require JavaScript.

HTTP POST Binding: The assertion is sent via an auto-submitted HTML form in the response body. Supports larger payloads and is more commonly used for responses.

Both flows protect against tampering through XML signatures embedded in the assertion.

Key Takeaway: SAML flows can be SP-initiated (user starts at the app) or IdP-initiated (user starts at the login portal), with assertions delivered via HTTP Redirect or POST bindings to complete secure single sign-on.