Need estimation?
Leave your contacts and get clear and realistic estimations in the next 24 hours.
Table of contentS
Each of us has been in a situation where we need to confirm our identity to receive some service: get admission to a closed event, board a plane, open a bank account, rent a house, and other common activities. To do this, we need to have a document proving our identity, which is government-issued. To issue such a document, the authority needs to collect some attributes that help to establish your identity, like your full name, photo, date of birth, fingerprints – so that it is deemed trustworthy and valid.
In the same way, to be able to access certain digital services, resources, or data that are not publicly available, users need to prove they are authorized to have this access. One way to do this is to create a digital identity with every service you need to access, giving the service provider your personal data and confirming your personal set of credentials each time you need to use the service. However, today, the number of digital services users access daily can be counted in dozens, so this approach does not look practical at all.
Thus, a modern way of accessing digital resources mimics the physical ID document approach: by relying on a trusted entity that can prove that our digital identity is genuine and can be trusted too. This entity is called an Identity Provider, the resources we need to access – Service Provider, and the process of identity verification – SAML 2.0 Authentication. Further in this article, we explain what SAML is, how it works, and how it can be implemented for your application.
SAML stands for Security Assertion Markup Language. SAML Authentication is the process of user authentication and authorization data exchange between identity providers (IdP) and service providers (SP) using SAML to authenticate and authorize that user to access a service.
In this communication, the Identity Provider is the system that performs authentication and passes data about the user's identity and authorization level to the service provider. The Service Provider is the system that receives the identity confirmation from the identity provider and authorizes a user to access the resource.
SAML transactions are based on XML (Extensible Markup Language) for encoding messages (security assertions) between the SP and IdP, hence the naming.
As an open standard for transferring identity data, the first SAML specification was officially announced by OASIS (The Organization for the Advancement of Structured Information Standards) in 2002. This resulted from prior attempts to develop an SSO (Single-sign-on) solution that could be standardized and applicable to different domains.
Single-sign-on is the method of authentication that allows a user to log in once on a system that functions as an identity provider and have access to other multiple applications (service providers), without the need to create and re-enter another pair of credentials for each application separately. This solution became sought-after back in the late 1990s when enterprises were adopting more and more computer systems in day-to-day operations, overwhelming employees and IT departments with password handling. Today, SSO is one of the golden standards in application security.
SSO implementation may rely on different protocols, such as SAML, OAuth 2.0, and OpenID Connect (OIDC). However, large organizations and B2B applications mostly prefer SAML for authentication as the one specifically designed for enterprise security and compliance. Here’s what this means:
While this article focuses on SAML SSO discussion and implementation, you can also check other articles on our blog to learn how to implement SSO using the OAuth protocol.
Now that we’ve got the relationship between SSO and SAML explained, you're halfway through understanding SAML SSO authentication. Next, let’s take a closer look at SAML itself and its components.
In the SAML framework, there are four basic components: the protocols, bindings, profiles, and flows.
The main point of SAML lies in sharing an authentication assertion – an XML document that contains information about a user and acts as proof of authentication. SAML protocols define the structure of this assertion and the rules for requesting and sending it by the communicating systems.
SAML bindings are the methods of message delivery in the SAML authentication process. They describe how authentication requests and responses get transported based on this or that communication protocol (HTTP, SOAP, or Redirect). For example, messages can be encoded into a URL and sent via an HTTP redirect, embedded in an HTML form and sent via HTTP POST, sent over SOAP using XML-based web services, etc.
In other words, SAML profiles are real-world use cases for SAML in applications. Each SAML profile is a specific, predefined combination of protocols, assertions, and bindings that is readily available for the system to be used. SAML protocols are useful as they standardize SAML implementation in similar scenarios, avoiding confusion and complexity. SAML profiles include Web SSO, Single Logout (SLO), Enhanced Client or Proxy (ECP), Identity Provider Discovery.
SAML flows are the different step sequences needed to complete an authorization and authentication process. They vary depending on the party that initiates the process and the SAML profile involved. Thus, SAML flows can be SP-initiated SSO, IdP-initiated SSO, SLO, etc.
Authentication is the process of verifying a user’s identity before they can gain access to a computer system, ensuring they are who they claim to be. In software systems, to prove their identity, a user needs to provide the system with a valid pair of credentials (e.g., an email address and a password) that only they know. These credentials can be created by the users themselves at the registration stage when they use a piece of software for the first time or can be provided to users by the system administrator. The latter is more common for enterprise business environments, e.g., when a new employee onboards the corporate ecosystem of apps.
In either case, for secure authentication, it is important that a series of security guidelines and policies be kept:
How does SAML work in the context of secure authentication? Taking into account the above security requirements, SAML ensures a range of characteristics that can guarantee secure authentication, especially in enterprise environments:
To explain how SAML authentication works in simple terms, let’s use an example. Say, a user wants to log in on their corporate Trello, Notion, and some other apps using their Google Workspace account. They go to the login feature on these apps, and, from the suggested login methods, they choose login with Google. They get redirected to the Google login page, where they enter their email address and password. If the login credentials are correct, the system accepts them, and the user logs into the app.
Thus, the user doesn’t need to create a separate account on each app or even register there – just use a single account (Google) to log in everywhere. Now, to understand what happens behind the curtains in this authentication process, let’s quickly recap the key “agents” in this workflow.
An IdP is the party responsible for user identity verification that is proving they are who they claim to be. It accepts login requests from the PS and issues security assertions and other authentication responses. This is also the system that the user originally provides all their data to (e.g. username, email, roles). Commonly known identity providers include Microsoft Entra ID, Google Workspace, Okta, OneLogin, Keycloak, etc. In our example above, we used Google Workspace as an example of an identity provider.
An SP is a Software-as-a-Service (SaaS) app, website, or other online service the user needs to log in on. To allow the user to access its data and resources and to know the user’s access level (role), the SP needs the identity provider’s authentication. Upon receiving it, the service provider allows the user to access its data and resources without asking them to provide any personal information or credentials. Some examples of SPs include popular enterprise solutions like Salesforce, Jira, and Zoho, as well as Trello and Notion we used in our sample flow above.
A SAML Assertion is an XML document that contains user authorization data, such as the user’s email, username, role, group membership, etc. It is issued by the IdP at SP’s request and is considered by the SP the proof of user identity. A SAML assertion consists of three main parts:
Thus, following the SAML process, the moment a user attempts to access an SP, it requests authorization and authentication from the IdP. The user gets redirected to the IdP, logs in once to sign on with the IdP, and in case the log-in is successful, the IdP verifies the session and passes the SAML attributes packed into the SAML assertion to the SP, following the use-case-specific SAML flow and profile, and sends the user back to the service.
This process looks complex, but in reality, it happens within seconds as the IdP and the SP rely on the same standard – SAML, provided it is configured properly for both the identity provider and the service provider.
How does SAML SSO work in detail? Here’s a step-by-step breakdown of the SAML SSO flow, describing the above diagram.
It’s also important to mention that for SAML authentication to work, both identity provider and service provider have to be configured properly to establish trust.
So we have discussed a common SAML authentication flow from the point of view of a user. But the most common request we get at Axon from clients is for an application to implement SAML integration. So what is SAML integration?
SAML integration is the implementation of the SAML authentication workflow in an application to enable SSO for its users, making it one of the parties in the process – a service provider. Thus, in this section, we describe the implementation of SAML SSO into a web app for it to function as a service provider supported by an identity provider of choice.
Decide, which IdP will handle user authentication and issue SAML assertions for your application. Popular IdPs that support SAML include:
Note: This and the following steps require domain-specific expertise and knowledge of identity and access management practices. Axon provides software development for small businesses, helping such companies implement technology solutions with high quality and commitment.
Here are some SAML libraries in different programming languages that can be used:
To configure your application as an SP, generate your SP metadata XML file, which should include:
Share with your IdP administrator the metadata files that contain your metadata file. With this information, the IdP will configure its settings to trust you as an SP. The IdP will then provide its own metadata file to your app in a URL or XML file. Make sure that you get:
Thus, you can configure your app as SP with IdP metadata to establish trust between the two entities.
Make sure your SAML authentication follows the flow:
As any software system, newly implemented SAML authentication will need some testing. To work with SAML, we suggest using several SAML debugging tools:
You might be also wondering about the special SAML SSO meaning for applications and how your business can benefit from it. Thus, we will explain the advantages of SAML for companies in this section.
It goes without saying that user-friendliness is the golden standard for modern UI and UX. Taking away the headache of multiple account management and creating and remembering multiple passports will be a life-saver for your users and will make them love your software.
The SAML flow ensures that your users have a single point of authentication and it is trusted and secure. The identity transfer information is also safeguarded by digital signatures, sensitive data encryption, and secure communication protocols. Also, SAML authentication ensures user credentials never leave the boundary of the firewall – a system that defends an internal network from traffic from less secure sources and prevents unauthorized users, devices, and applications from entering the network.
SAML decouples your security from a vendor’s system or specific platform structures, eliminating the need for you to keep user information synchronized between directories. Therefore, it doesn’t matter which system they’re using, they can log in anyway. This takes off the requirement to adjust the application security system to various structures.
SAML doesn’t require synchronization between directories for each application, so there’s no need for the identity provider to ask each service provider to grant, revoke, or change access levels. Instead, you can manage access centrally for a single service or across the enterprise. Also, due to the centralization of authentication logs, you can conduct an access audit in the same way.
When users have only one pair of credentials to remember and manage, there’s so much less chance they will forget them or store them in an insecure way. Consequently, your IT admins get fewer password reset tickets to deal with and can focus on other business-critical tasks.
The centralized nature of SAML-based authentication allows you to add new users, applications, and services to your corporate digital ecosystem quickly and with minimal effort.
With SAML, authentication is done on the identity provider’s side, which means you don't have to build and maintain complex password storage and security infrastructure to maintain account information from multiple services. It also brings helpdesk efficiency optimization with fewer issue requests, user management automation, and less chance of security breaches.
SAML can work well with a diverse range of platforms, applications, and identity providers due to its XML nature, which is a widely accepted standard. Also, since authorization is handled by the identity provider, service provider compatibility with the underlying authentication method is not an issue. Finally, the availability of multiple binding methods ensures SAML will work across different network architectures.
Both SAML (Security Assertion Markup Language) and OAuth (Open Authorization) are authentication and authorization standards and enable SSO, saving users (and IT admins) from multiple account- and password-handling distress. However, in the end, they serve different purposes and thus can be used rather complementary than interchangeably. Let’s break this down.
OAuth is an authorization standard or protocol co-developed by Google and Twitter to enable users to log in to different internet sites using their social media accounts (like Facebook or Google) and without providing the service with their credentials or creating a separate account. At first glance, this looks very similar to SAML, but it’s rather different behind the scenes.
First, in the OAuth flow, there are different agents involved: the user (also the resource owner), an application or service (client), an authorization server, and a resource server. Secondly, the process is also different:
As you can see, in this process a different mechanism is employed, where authentication does take place but user credentials are not stored on the server and they are only needed to authorize data sharing. Also, in SAML flow, the identity provider generates a SAML assertion to prove the user identity, while in OAuth the authorization server generates an access token confirming user authorization
Does this all mean that SAML is a better choice for enterprise solutions than OAuth? Both yes and not exactly. SAML will remain the preferred choice for enterprise SSO implementation with its support of federated authentification, more control and security for SSO, and compliance with common data protection guidelines. At the same time, OAuth can be of great use for integrating third-party applications in enterprise environments by providing an authorization mechanism for granting API access.
For a more in-depth review of the OAuth protocol and its implementation, read our how-to guide on OAuth 2.0 implementation with Passport.js.
Summing up, SAML is a reliable, well-standardized, tried and tested mechanism for implementing the single sign-on feature in integrated systems, particularly valuable for enterprise environments. It follows a simple flow and requires only three agents – a user, a service provider, and an identity provider – for a quick and secure authentication to complete.
SAML is highly secure and flexible at the same time, ensuring compatibility with a multitude of technologies and applications and allowing companies to choose identity providers and service providers they prefer. It differs from the OAuth protocol, and thus they cannot be used interchangeably, however, they can be implemented along with each other to provide more integration opportunities.
We hope this article was helpful. If you are creating a software application that needs SSO implementation, you have more identity and access management features in your backlog, or even if you haven’t made a decision yet, expert consultants at Axon will be more than happy to assist. All you have to do is let us know your business concern by filling in the contact form below.
SAML 1.1 is the old version of the Security Assertion Markup Language replaced by SAML 2.0 in 2005. It only supported SSO, used a simple NameIdentifier to identify users, potentially leading to inconsistencies between systems, offered competing methods for SSO, causing interoperability issues, employed disparate communication protocols, increasing complexity, and lacked flexibility in binding mechanisms. SAML 2.0 introduced a number of improvements, such as Single Logout in addition to SSO, multiple NameID formats adding flexibility, Authentication Context specifying authentication methods used, standardized Web Browser SSO Profiles, a single standard for communication protocols eliminating complexities, more binding mechanisms, and metadata exchange for easier SP and IdP integration.
SAML enhances application security by implementing various protective measures at the user authentication stage. It uses encryption, digital signatures, and TLS to prevent interception, blocks login replay attacks with timestamps and unique identifiers, and ensures authentication only from trusted providers through federated identity. Also, it supports the use of best security practices by reducing the need for managing multiple accounts and credentials.
Despite the fact that SAML has been around for a while and might seem archaic in contrast with more modern authorization standards like OAuth and OIDC, it remains in high demand for large enterprise systems. Big companies and B2B software can greatly benefit from the level of security it ensures, as well as improved UX, centralized access management, and flexibility in implementation.
Free product discovery workshop to clarify your software idea, define requirements, and outline the scope of work. Request for free now.
[1]
[2]
Leave your contacts and get clear and realistic estimations in the next 24 hours.