Understanding the Basics of the SAML Federation Protocol


2024-05-03
7 minutes
Samuel Monsempes
Share:  

 

Table of contents


In today's digital world, the need for secure and efficient identity and access management is paramount. One of the key technologies that enable secure authentication and authorization for web-based applications is the Security Assertion Markup Language (SAML) Federation protocol. In this article, we will explore the fundamentals of SAML Federation, starting from its inception to the intricate details of its implementation.

Introduction to SAML Federation

SAML, or the Security Assertion Markup Language, has been an integral part of the authentication and authorization landscape since its debut in 2001. Its version 2.0, introduced in 2005, solidified its position as an open standard widely used to provide single sign-on (SSO) capabilities for web-based applications. SAML plays a crucial role in both authentication and authorization processes.

Entities in the SAML Protocol

To grasp the concept of SAML Federation, it's essential to understand the three key entities involved in the process:

  1. User Agent: Typically, the user's web browser.
  2. Service Provider (SP): The application or service that users are trying to access.
  3. Identity Provider (IDP): The system responsible for authenticating users.

Establishing Trust in SAML Federation

At the heart of SAML Federation is the establishment of a trust relationship between the Service Provider (SP) and the Identity Provider (IDP). When a user intends to access a service provided by the SP, the IDP must first authenticate the user. If successful, the IDP generates a SAML assertion, which is then sent to the SP. Since the SP trusts the IDP, the user is granted access. This process enables single sign-on (SSO) capabilities, allowing users to seamlessly access multiple applications without re-authenticating.

Integration Rules and Metadata Exchange

To ensure successful SAML Federation, it's crucial to define integration rules that govern the exchange of information between the SP and IDP. For instance, the SP may require that the user identifier be in a specific format, such as an email address. Both the SP and IDP must agree on these rules and configure their systems accordingly.

This configuration process can be done manually, but it's often simplified by exchanging XML metadata files. These files contain configuration settings and certificates, facilitating the setup of trust between the SP and IDP. This metadata exchange is the cornerstone of trust establishment in SAML Federation.

Name ID Formats and Entity Identifiers

The metadata file includes specifications for the name ID formats, which define how user identifiers are formatted. While there are standardized name ID formats, such as "unspecified" or "email," it's vital that both the SP and IDP use the same format to ensure compatibility.

Additionally, the metadata contains the entity identifier, which uniquely identifies the sender or receiver in the Federation.

Initiating Authentication Flows

Authentication in SAML Federation can be initiated in two primary ways:

  1. IDP-Initiated Flow: In this flow, the user begins by accessing the Identity Provider (IDP), where they authenticate. Once authenticated, the user can request access to a service provided by the SP. If authorized, the IDP generates a SAML assertion, which is sent to the SP. The user's web browser acts as the transport mechanism for this assertion.
  2. SP-Initiated Flow: In this scenario, the user starts by accessing the Service Provider (SP). Since the user is not yet authenticated, the SP redirects them to the IDP for authentication. Once validated, the IDP generates a SAML assertion, which is sent to the SP via the user's web browser.

SAML Bindings: How Messages Are Sent

SAML specifies different bindings that dictate how messages and assertions are technically sent between the SP and IDP. These bindings include:

  • HTTP Redirect Binding: Used for sending requests for authentication from the SP to the IDP.
  • HTTP POST Binding: The most common method for transporting both assertion and request messages.
  • SAML Artifact Binding: A specialized binding that involves the exchange of a unique identifier (the artifact) sent from the IDP to the SP. The SP then requests the actual assertion from the IDP.

Anatomy of a SAML Assertion

The SAML assertion itself is a critical component of the Federation process. It contains various elements, including:

  • Name ID Format: Specifies how the user's identifier is formatted (e.g., email).
  • Authentication Context Class: Identifies the method used for user authentication, determining the level of confidence in the user's identity.
  • Attributes: Additional information about the user.
  • Conditions: Specifies the validity period of the assertion, protection against replay attacks, and the intended audience.
  • Issuer: Identifies the entity that generated the assertion.
  • Digital Signature: Protects the assertion from tampering.

Putting SAML Federation into Practice

To better understand the practical aspects of SAML Federation, let's walk through two scenarios: IDP-initiated and SP-initiated authentication flows.

IDP-Initiated Flow

In this scenario, the user begins by accessing the Identity Provider (IDP). After authentication, the user can request access to a service provided by the SP. The IDP generates a SAML assertion, which is sent to the SP. This assertion contains crucial information about the user, including the authentication method used.

SP-Initiated Flow

In an SP-initiated flow, the user starts by accessing the Service Provider (SP). The SP, recognizing that the user is not authenticated, redirects them to the IDP for authentication. Once authenticated, the IDP generates a SAML assertion, which is sent to the SP, enabling the user's access to the requested service.

Conclusion

SAML Federation is a powerful protocol that enables secure and seamless authentication and authorization for web-based applications. Understanding its core concepts, such as trust establishment, integration rules, message bindings, and the anatomy of SAML assertions, is essential for implementing effective identity and access management solutions. By mastering these fundamentals, organizations can enhance security and user experience in the digital age.


The author

Samuel Monsempes
Senior Cyber Security Engineer at Senthorus
Former farmer turned cybersecurity engineer, valedictorian of the top-ranked French computer science school and staff of the international cybersecurity conference Grehack.


Superpowers