# SSO, OAuth 2.0 and OpenID Connect

> Learn how single sign-on and delegated access work with SAML, OAuth 2.0 and OIDC, and the misconfigurations attackers exploit. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/cybersecurity/federation-sso
Last updated: 2026-11-28

Learn how single sign-on and delegated access work with SAML, OAuth 2.0 and OIDC, and the misconfigurations attackers exploit.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [Authorization and Least Privilege](https://www.internhack.in/roadmaps/tracks/cybersecurity/access-control-models), [HTTP for Security Work](https://www.internhack.in/roadmaps/tracks/cybersecurity/http)

Employees log in once and reach dozens of apps; users click "Sign in with Google". That convenience is **federated identity**, and it concentrates risk in the identity provider.

### The players

- **Identity Provider (IdP)**: authenticates the user (Microsoft Entra ID, Okta, Google).
- **Service Provider / Relying Party**: the app that trusts the IdP.
- **Tokens or assertions**: signed statements from the IdP saying who the user is.

### Protocols

- **SAML 2.0**: XML assertions, common in enterprise SSO.
- **OAuth 2.0**: an **authorization** framework for delegated access ("let this app read my calendar"). It issues **access tokens**, not identity.
- **OpenID Connect (OIDC)**: an identity layer on top of OAuth 2.0 that adds an **ID token** (a JWT) describing the user.

Know the **authorization code flow with PKCE**, which is the recommended flow for web and mobile apps. The implicit flow is deprecated.

### Common weaknesses

- Open redirects or loose `redirect_uri` matching that leak authorization codes.
- Missing `state` parameter enabling login CSRF.
- Not validating token signature, audience, issuer or expiry.
- Over-broad scopes granted to third-party apps (consent phishing).
- SAML signature wrapping bugs in custom implementations.

### Why defenders care

A compromised IdP account can reach every connected app. Protect it with phishing-resistant MFA, conditional access and monitoring of risky sign-ins.

Good enough to move on: you can draw the OIDC authorization code flow with PKCE and name two checks a relying party must make on an ID token.

## Key concepts

- **IdP and relying party roles**
- **SAML 2.0 basics**
- **OAuth 2.0 roles and scopes**
- **OIDC and ID tokens**
- **Authorization code flow with PKCE**
- **redirect_uri and state pitfalls**
- **Consent phishing**

## Mini project

Register a test app with a free IdP developer tenant, implement login with OIDC and PKCE, and verify the ID token's signature, issuer, audience and expiry yourself.

## Check yourself

Why is OAuth 2.0 alone not an authentication protocol, and what does OIDC add?

## Free resources

- [OAuth 2.0](https://oauth.net/2/) (oauth.net)
- [How OpenID Connect Works](https://openid.net/developers/how-connect-works/) (OpenID Foundation)
- [PortSwigger: OAuth authentication vulnerabilities](https://portswigger.net/web-security/oauth) (PortSwigger)

Previous: [Authorization and Least Privilege](https://www.internhack.in/roadmaps/tracks/cybersecurity/access-control-models) · Next: [IAM Operations and Privileged Access](https://www.internhack.in/roadmaps/tracks/cybersecurity/iam-operations)

## More in Identity and Access Management

- [Authentication and MFA](https://www.internhack.in/roadmaps/tracks/cybersecurity/authentication-mfa)
- [Authorization and Least Privilege](https://www.internhack.in/roadmaps/tracks/cybersecurity/access-control-models)
- [SSO, OAuth 2.0 and OpenID Connect](https://www.internhack.in/roadmaps/tracks/cybersecurity/federation-sso)
- [IAM Operations and Privileged Access](https://www.internhack.in/roadmaps/tracks/cybersecurity/iam-operations)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Cybersecurity Roadmap](https://www.internhack.in/roadmaps/tracks/cybersecurity)
