How does SAML work

How SAML Works

SAML works by passing authentication information (assertions) between an Identity Provider (IdP) and a Service Provider (SP) in a secure manner. The process follows these steps:

  1. User Requests Access

    • A user attempts to access a service (SP), like an enterprise application.
  2. Redirect to Identity Provider (IdP)

    • The SP redirects the user to the IdP, which is responsible for verifying user credentials.
  3. User Authentication at IdP

    • The user provides their login credentials (e.g., username and password) to the IdP.
  4. SAML Assertion Creation

    • Upon successful authentication, the IdP generates a SAML Assertion (an XML document containing user identity and permissions).
  5. Assertion Sent to SP

    • The IdP sends the SAML assertion to the SP via the user's browser or direct backchannel communication.
  6. SP Validates Assertion

    • The SP verifies the assertion's authenticity using cryptographic signatures.
  7. User Gains Access

    • If the assertion is valid, the SP grants access to the requested resource without requiring another login.

Key Components of SAML

  • Identity Provider (IdP) – The system that authenticates users (e.g., Okta, Azure AD, Google Workspace).
  • Service Provider (SP) – The application or service users want to access.
  • SAML Assertions – Secure XML documents containing authentication and authorization data.
  • SAML Bindings – Defines how messages are exchanged (e.g., HTTP Redirect, HTTP POST).
  • SAML Metadata – XML-based configuration files that describe IdP and SP capabilities.

Benefits of SAML

  • Single Sign-On (SSO): Users log in once and access multiple apps.
  • Security: Uses encrypted assertions to protect user data.
  • Improved User Experience: Eliminates the need for multiple passwords.