Progressive Full Stack Application Development with Live Projects

Backend Development

Single Sign-On Authentication – Simple Concise Notes

Introduction to Single Sign-On (SSO)

SSO is an authentication method that allows users to access multiple applications and services with a single set of credentials.

Examples of Single Sign-On (SSO)

There are many real-world examples of applications that use Single Sign-On (SSO). 

  1. Google Workspace (Gmail, Drive, Docs, etc.)

  2. Microsoft 365 (Outlook, Teams, OneDrive, etc.)

  3. Atlassian (Jira, Confluence, etc.)

  4. AWS (Amazon Web Services) offers SSO through AWS IAM Identity Center.

Protocols for Single Sign-On (SSO)

Single Sign-On (SSO) is made possible by several authentication and authorization protocols that securely handle identity verification across systems.

🔐 1. SAML (Security Assertion Markup Language)

  • Type: XML-based authentication protocol

  • Use Case: Enterprise SSO (e.g., corporate logins to apps like Salesforce, AWS)

  • Flow:

    1. User tries to access a service provider (e.g., Salesforce).

    2. Gets redirected to the identity provider (e.g., Okta).

    3. Identity provider authenticates the user and sends a SAML assertion.

    4. Service provider grants access.

  • Pros: Mature, widely supported in enterprise.

  • Cons: XML-based and more complex; less friendly for mobile apps.


🔓 2. OAuth 2.0 (Open Authorization)

  • Type: Authorization framework (not strictly authentication)

  • Use Case: Used by APIs and third-party apps for delegated access (e.g., “Login with Google”)

  • Flow:

    1. App redirects user to OAuth provider (e.g., Google).

    2. User authorizes access.

    3. Provider sends an access token back to the app.

  • Pros: Lightweight, widely supported, ideal for APIs.

  • Cons: Not originally designed for authentication (often used with OpenID Connect).


🧾 3. OpenID Connect (OIDC)

  • Type: Identity layer built on top of OAuth 2.0

  • Use Case: Authentication and SSO (e.g., Google SSO, Microsoft SSO)

  • Flow:

    1. Follows OAuth flow but adds an ID token (JWT) for authentication.

    2. App can validate who the user is.

  • Pros: Simple, mobile-friendly, uses JSON Web Tokens (JWT).

  • Cons: Slightly newer; not always supported in older enterprise apps.


🗝️ 4. Kerberos

  • Type: Network authentication protocol

  • Use Case: Windows domain authentication (e.g., internal corporate networks)

  • Flow:

    1. User logs in once.

    2. Kerberos issues tickets that can be reused to access multiple services.

  • Pros: Highly secure, used in traditional enterprise networks.

  • Cons: Complex to configure; mostly used within internal networks.


 

A Typical SSO login flow

1. User Accesses Application

  • User visits an app (e.g., Gmail or Salesforce).

  • The app is the Service Provider (SP).


2. SP Redirects to Identity Provider (IdP)

  • SP detects this is a corporate user.

  • SP creates a SAML Authentication Request.

  • The browser is redirected to the Identity Provider (IdP) (e.g., Okta, Auth0, OneLogin).


3. User Authenticates with IdP

  • If not already logged in, user enters credentials at the IdP login page.

  • IdP verifies the user’s identity.


4. IdP Sends SAML Response to SP

  • IdP creates a SAML Response containing a signed authentication assertion.

  • The browser posts the response back to the SP’s Assertion Consumer Service (ACS) URL.


5. SP Grants Access

  • SP validates the SAML assertion (signature, timestamps, audience, etc.).

  • If valid, the user is authenticated and granted access to the app.

Building a SSO System?

If you’re building or integrating an SSO system in a new web application,  integrating with some of the more popular OpenID Connect platforms like Google,  Facebook, and Github is probably a great choice.