Authorization Basics

5 mins read

SAML Key Concepts

Explore the Core Concepts of SAML: This article delves into the key components of SAML, including Profiles, Assertions Bindings, providingand a comprehensive understanding of how they work together to enable secure identity and access management in modern applications.

What SAML Assertions Are

A SAML assertion is an XML-based statement within the Security Assertion Markup Language (SAML) framework that conveys information about a user’s identity, authentication status, and optionally, authorization attributes. These assertions are issued by identity providers (IdPs) and are used in single sign-on (SSO) systems to securely share authentication and authorization data with service providers (SPs). SAML assertions play a crucial role in establishing trust and enabling secure access to resources based on a user’s credentials and attributes in federated identity management scenarios. There are different types of SAML assertions, with three primary categories:

  • Authentication Assertions (Authentication Statements): These assertions primarily provide information about the user’s authentication, such as when and how the user was authenticated. They confirm the user’s identity.

  • Attribute Assertions (Attribute Statements): These assertions contain additional user attributes beyond authentication, which can be used for authorization purposes. For example, they might include the user’s roles, permissions, or other user-specific data.

  • Authorization Decision Assertions: Authorization Decision Assertions are used to communicate authorization decisions made by the identity provider (IdP) to the service provider (SP). These assertions inform the SP whether the user is allowed or denied access to specific resources or actions within the SP’s application. This type of assertion plays a crucial role in enforcing access control policies and ensuring secure access to resources based on the user’s attributes and permissions.

Looking for SAML Support?

You can register SAML Service Providers in Cloudentity, connect SAML-based IDPs for user authentication, and more!

SAML Assertion Example

Here’s a simplified example of a SAML assertion:

<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                ID="_abc123"
                IssueInstant="2023-09-13T12:00:00Z"
                Version="2.0">
    <saml:AttributeStatement>
        <saml:Attribute Name="UserID" Format="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
            <saml:AttributeValue>123456</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute Name="Email" Format="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
            <saml:AttributeValue>user@example.com</saml:AttributeValue>
        </saml:Attribute>
    </saml:AttributeStatement>
    <saml:AuthnStatement AuthnInstant="2023-09-13T12:00:00Z">
        <saml:AuthnContext>
            <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef>
        </saml:AuthnContext>
    </saml:AuthnStatement>
</saml:Assertion>

In this example:

  • The <saml:Assertion> element encapsulates the entire SAML assertion.
    • The ID attribute provides a unique identifier for the assertion.
    • IssueInstant indicates when the assertion was issued.
    • Version specifies the SAML version being used.
  • Inside the <saml:AttributeStatement> element, there are two attribute statements:
    • The first <saml:Attribute> element specifies the user’s ID, and its value is “123456.”
    • The second <saml:Attribute> element specifies the user’s email address as “user@example.com.”
  • The <saml:AuthnStatement> element contains information about the user’s authentication:
    • AuthnInstant indicates the time of authentication.
    • <saml:AuthnContext> specifies the context of the authentication, with a reference to the “Password” authentication context class.

Please note that this is a simplified example. In a real-world scenario, SAML assertions can contain more attributes, digital signatures for security, and additional elements depending on the use case and requirements of the identity and service providers involved in the SAML SSO process.

What SAML Bindings Are

SAML bindings are mechanisms that define how SAML messages are exchanged between different entities in a Security Assertion Markup Language (SAML) based authentication and authorization system. In SAML, there are several standard bindings that specify how SAML messages are transmitted, where they are sent, and how they are formatted. These bindings are crucial for establishing communication between identity providers (IdPs) and service providers (SPs) and ensuring the security and integrity of SAML exchanges. Here are some common SAML bindings:

  • HTTP Redirect Binding: SAML messages, such as authentication requests or responses, are sent as URL query parameters in an HTTP redirect. This is useful for carrying SAML messages through a user’s browser.

  • HTTP POST Binding: SAML messages are embedded in the body of an HTTP POST request. This binding is often used when sending larger or sensitive SAML messages that shouldn’t be exposed in the URL.

  • HTTP Artifact Binding: Instead of sending the entire SAML message, a reference (artifact) to the message is sent over HTTP. The recipient can then retrieve the actual SAML message using the artifact.

  • SOAP Binding: SAML messages can be encapsulated within SOAP (Simple Object Access Protocol) messages when integrating with web services and SOAP-based systems.

Each binding serves a specific purpose and is chosen based on the requirements and constraints of the integration between IdPs and SPs. The selection of the appropriate binding depends on factors such as security, transport protocol, and the capabilities of the systems involved. It’s essential to ensure that the chosen binding aligns with the security and privacy needs of the SAML-based authentication and authorization system.

SAML Profiles

In the context of the Security Assertion Markup Language (SAML), SAML profiles are standardized sets of rules and guidelines that define how SAML assertions and protocol messages should be used in specific use cases or scenarios. SAML profiles help ensure interoperability and provide clear instructions for implementing SAML-based Single Sign-On (SSO) and identity federation solutions. There are several SAML profiles, each designed for specific purposes. Some common SAML profiles include:

1.Web Browser SSO Profile: This is one of the most widely used SAML profiles. It defines how SAML assertions and protocol messages are exchanged between a user’s web browser, an identity provider (IdP), and a service provider (SP) to enable SSO for web applications. It typically involves HTTP Redirect and HTTP POST bindings.

2.Single Logout Profile: This profile specifies how to log a user out from all participating service providers when they log out from the identity provider. It ensures synchronized logout across multiple applications.

3.Attribute Sharing Profile: This profile focuses on how to exchange user attributes and authorization information between the IdP and SP, enabling fine-grained access control based on user attributes.

4.Identity Provider Discovery Profile: It outlines how service providers can discover and dynamically select an appropriate identity provider for a user, based on various criteria.

5.Attribute Query Profile: This profile defines how a service provider can request additional user attributes from an identity provider after the initial authentication.

These SAML profiles serve as guidelines for implementing various SSO and federated identity scenarios. When organizations or developers implement SAML-based solutions, they typically choose the profile(s) that best fit their specific use case and adhere to the corresponding SAML standards and recommendations. This ensures that SAML-based systems work reliably and securely across different platforms and applications.

Updated: Sep 15, 2023