What is SAML and How SAML Authentication Works

Discover the advantages of SAML, explore its functionality, and determine if it is the right fit for your business.

What is SAML

Security Assertion Markup Language (SAML) is an XML-based standard protocol for exchanging authentication data between two parties. SAML is designed to enable Single Sign- On (SSO) across different applications and systems that belong to the same organization or consortium. SAML allows a user to log in once and then access multiple applications or services without having to log in again for each application or service, this is exactly SSO.

SAML is based on the concept of a trust relationship between the identity provider (IdP) and the service provider (SP). The IdP is responsible for authenticating the user and providing the necessary identity information in the form of SAML assertions to the SP. SP uses the SAML assertions to grant or deny access to resources.

SAML is famous in enterprise environments, online service providers and government agencies. It is most popula SSO protocols. The SAML standard is maintained by the Organization for the Advancement of Structured Information Standards (OASIS), and it is continually evolving to meet the changing security and privacy requirements of modern internet based applications.

Benefits of SAML

SAML terminology

SAML flows

Here is The general steps of creating a SAML assertion and consumption involves the following steps:

IdP initiated

SAML IdP-initiated flow is a scenario where the user is first authenticated by the Identity Provider (IDP) and then redirected to a Service Provider (SP) application without the user having to initiate the request. The process involves the following steps:


SP-Intiated

SAML SP-initiated flow is a scenario where user initiates the request to access a Service Provider (SP) application and is then redirected to the Identity Provider (IDP) for authentication. The process involves the following steps:


SAML Use cases

Workforce SSO

SAML is very popular into Workforce SSO, All the Workforce SSO providers support SAML so it can be integrated with internal tools either SaaS or on-prem. Using workfoce SSO companies can control their employees accesses from a single dashboard, onboarding, management and offbording. As SAML is well defined protocol so it’s highly secure and flexible which fits in enterprise ecosystem for identity use case. All the enterprises and mid-sized businesses use Workforce SSO.

B2B SaaS SSO

When we say that all the Enterprise and mid-sized use Workforce SSO means all B2B SaaS solution who deal or want to deal in this segment means they require to integrate SAML so their customer’s Workforce SSO can be integrated with their system. All the B2B SaaS platform these days supports integration of Workforce SSO.

Example SAML Response

<samlp:Response ID="_257f9d9e9fa14962c0803903a6ccad931245264310738"

IssueInstant="2009-06-17T18:45:10.738Z" Version="2.0">

<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">

https://www.salesforce.com

</saml:Issuer>

<samlp:Status>

<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>

</samlp:Status>

<saml:Assertion ID="_3c39bc0fe7b13769cab2f6f45eba801b1245264310738"

IssueInstant="2009-06-17T18:45:10.738Z" Version="2.0">

<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">

https://www.salesforce.com

</saml:Issuer>

<saml:Signature>

<saml:SignedInfo>

<saml:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>

<saml:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>

<saml:Reference URI="#_3c39bc0fe7b13769cab2f6f45eba801b1245264310738">

<saml:Transforms>

<saml:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-

signature"/>

<saml:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">

<ec:InclusiveNamespaces PrefixList="ds saml xs"/>

</saml:Transform>

</saml:Transforms>

<saml:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>

<saml:DigestValue>vzR9Hfp8d16576tEDeq/zhpmLoo=

</saml:DigestValue>

</saml:Reference>

</saml:SignedInfo>

<saml:SignatureValue>

AzID5hhJeJlG2llUDvZswNUrlrPtR7S37QYH2W+Un1n8c6kTC

Xr/lihEKPcA2PZt86eBntFBVDWTRlh/W3yUgGOqQBJMFOVbhK

M/CbLHbBUVT5TcxIqvsNvIFdjIGNkf1W0SBqRKZOJ6tzxCcLo

9dXqAyAUkqDpX5+AyltwrdCPNmncUM4dtRPjI05CL1rRaGeyX

3kkqOL8p0vjm0fazU5tCAJLbYuYgU1LivPSahWNcpvRSlCI4e

Pn2oiVDyrcc4et12inPMTc2lGIWWWWJyHOPSiXRSkEAIwQVjf

Qm5cpli44Pv8FCrdGWpEE0yXsPBvDkM9jIzwCYGG2fKaLBag==

</saml:SignatureValue>

<saml:KeyInfo>

<saml:X509Data>

<saml:X509Certificate>

MIIEATCCAumgAwIBAgIBBTANBgkqhkiG9w0BAQ0FADCBgzELM

[Certificate truncated for readability...]

</saml:X509Certificate>

</saml:X509Data>

</saml:KeyInfo>

</saml:Signature>

<saml:Subject>

<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">

saml01@salesforce.com

</saml:NameID>

<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">

<saml:SubjectConfirmationData NotOnOrAfter="2009-06-17T18:50:10.738Z"

Recipient="https://login.salesforce.com"/>

</saml:SubjectConfirmation>

</saml:Subject>

<saml:Conditions NotBefore="2009-06-17T18:45:10.738Z" NotOnOrAfter="2009-06-

17T18:50:10.738Z">

<saml:AudienceRestriction>

<saml:Audience>https://saml.salesforce.com</saml:Audience>

</saml:AudienceRestriction>

</saml:Conditions>

<saml:AuthnStatement AuthnInstant="2009-06-17T18:45:10.738Z">

<saml:AuthnContext>

<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified

</saml:AuthnContextClassRef>

</saml:AuthnContext>

</saml:AuthnStatement>

<saml:AttributeStatement>

<saml:Attribute Name="portal_id">

<saml:AttributeValue xsi:type="xs:anyType">060D00000000SHZ

</saml:AttributeValue>

</saml:Attribute>

<saml:Attribute Name="organization_id">

<saml:AttributeValue xsi:type="xs:anyType">00DD0000000F7L5

</saml:AttributeValue>

</saml:Attribute>

<saml:Attribute Name="ssostartpage"

NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">

<saml:AttributeValue xsi:type="xs:anyType">

http://www.salesforce.com/security/saml/saml20-gen.jsp

</saml:AttributeValue>

</saml:Attribute>

<saml:Attribute Name="logouturl"

NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">

<saml:AttributeValue xsi:type="xs:string">

http://www.salesforce.com/security/del_auth/SsoLogoutPage.html

</saml:AttributeValue>

</saml:Attribute>

</saml:AttributeStatement>

</saml:Assertion>

</samlp:Response>

Conclusion

SAML solves the Security and User experience problems with greater flexibility, it is defacto solution when we think about the identity exchange between two parties. SAML’s strength is it’s well define specification which make this fir for most of the use canse of Identity Federation and SSO. SAML is not that popular in B2C applications, JWT, OAuth and OIDC are well known protocols into B2C.

Article Source: https://ssojet.com/blog/what-is-saml-and-how-saml-authentication-works/