Identity and Access Management (IAM): SSO, RBAC, OAuth and PAM
Who are you, what are you allowed to do and who decided that? Identity and Access Management (IAM) answers these questions for every person, device and application in an organisation. Because most modern attacks involve stolen identities or excessive permissions, IAM has become the new perimeter of security. This lesson explains the core concepts, the protocols behind single sign-on and the practices that make access safer.
Authentication vs Authorisation
| Concept | Question | Example |
|---|---|---|
| Identification | Who do you claim to be? | Typing a username |
| Authentication (AuthN) | Can you prove it? | Password plus a code |
| Authorisation (AuthZ) | What may you do? | Read the file, but not delete it |
| Accounting / auditing | What did you do? | Access logs |
Confusing authentication with authorisation is behind many serious vulnerabilities: a system may correctly know who you are yet fail to check what you may do; see Broken Access Control, IDOR and Session Flaws.
The Identity Lifecycle
- Joiner: create the identity and grant initial access based on role.
- Mover: adjust access when someone changes roles, removing old permissions.
- Leaver: disable access promptly when someone departs.
- Periodic review: managers confirm that access is still needed (access recertification).
“Permission creep” happens when movers keep old access and accumulate rights. Orphaned accounts of departed staff are a classic way attackers gain entry. Automating the joiner-mover-leaver process, ideally from the HR system, closes much of this gap.
Access Control Models
| Model | How decisions are made | Typical use |
|---|---|---|
| DAC (Discretionary) | The owner of a resource decides who gets access | File sharing, ordinary operating systems |
| MAC (Mandatory) | A central policy with labels (for example, Secret, Confidential) decides | Military and high-security systems |
| RBAC (Role-based) | Permissions are assigned to roles; users get roles | Most enterprise applications |
| ABAC (Attribute-based) | Decisions use attributes of user, resource and context (department, time, location, device health) | Fine-grained, dynamic environments, zero trust |
A simple RBAC example for a hospital application: the Nurse role may read and update patient charts for their ward, the Billing Clerk role may view invoices but not clinical notes, and the Administrator role may manage accounts but not read patient data. Roles map to job functions, which keeps the model understandable and auditable.
Single Sign-On and Federation
Single sign-on (SSO) lets users log in once with a central identity provider (IdP) and access many applications (service providers or relying parties) without separate passwords. Benefits: fewer passwords, central MFA, faster deprovisioning, better logging. Risk: the IdP becomes a high-value target, so it needs the strongest protections.
Key protocols
| Protocol | Purpose | Typical use |
|---|---|---|
| SAML 2.0 | XML-based SSO between organisations and enterprise applications | Corporate web SSO |
| OAuth 2.0 | Delegated authorisation: lets an app access resources on your behalf without your password | “Allow this app to read your calendar” |
| OpenID Connect (OIDC) | An identity layer on top of OAuth 2.0 that adds authentication | “Sign in with …” buttons, modern SSO |
| Kerberos | Ticket-based network authentication | Windows domains |
| LDAP | Directory access protocol | Querying and authenticating against directories |
| RADIUS / TACACS+ | Network access authentication and device administration | Wi-Fi, VPN, network devices |
| SCIM | Automated user provisioning between systems | Joiner, mover, leaver automation |
OAuth 2.0 in plain language
Imagine you want a photo-printing site to access photos stored in your cloud account. Instead of giving it your password, the printing site sends you to your cloud provider. You log in there, see exactly what the site requests (its scopes) and approve. The provider gives the site a limited access token, typically short-lived. The printing site never learns your password and can only do what the scopes allow. Weak redirect URI validation, overly broad scopes and tokens leaked in logs or URLs are the classic mistakes; see API Security Essentials.
Privileged Access Management (PAM)
Administrator, root and service accounts can do the most damage, so they deserve extra protection:
- Separate admin accounts from everyday accounts.
- Vault privileged credentials and rotate them automatically; check them out for a task and record the session.
- Just-in-time (JIT) access: grant elevated rights only when needed and for a limited time, rather than standing privilege.
- Just-enough-administration: give the minimum rights for the job.
- Require MFA for every privileged action.
- Record and review privileged sessions.
- Secure non-human identities: service accounts, API keys and machine credentials are numerous and often neglected; give each an owner, narrow permissions and an expiry.
Practice Lab: A Tiny RBAC Check
This short Python example shows the idea of role-based authorisation with a deny-by-default rule:
ROLE_PERMISSIONS = {
"nurse": {"chart:read", "chart:update"},
"billing": {"invoice:read", "invoice:update"},
"admin": {"user:create", "user:disable"},
}
def is_allowed(user_roles, permission):
# Deny by default: allowed only if some role grants the permission
return any(permission in ROLE_PERMISSIONS.get(role, set()) for role in user_roles)
print(is_allowed(["nurse"], "chart:read")) # True
print(is_allowed(["billing"], "chart:read")) # False
print(is_allowed(["admin"], "chart:read")) # False: admins manage users, not charts
print(is_allowed([], "chart:read")) # False: no roles, no access
Notice two principles: deny by default and permissions attached to roles, not people. Then extend the exercise: add an attribute check (for example, nurses may only read charts for their own ward) and discuss where RBAC ends and ABAC begins.
Practice Lab: Audit Linux Accounts on Your Own VM
cut -d: -f1,3,7 /etc/passwd # users, UIDs, shells
awk -F: '$3 == 0 {print $1}' /etc/passwd # which accounts have UID 0 (should only be root)
sudo grep -E "^sudo|^wheel" /etc/group # who can use sudo
last -n 10 # recent logins
sudo lastb -n 10 2>/dev/null # recent failed logins
Write down any account you cannot explain and decide whether it should exist.
IAM Best-Practice Checklist
- Enforce MFA for everyone, and phishing-resistant MFA for administrators.
- Centralise identity and use SSO where possible.
- Apply least privilege and review access regularly.
- Automate joiner-mover-leaver processes.
- Use PAM for privileged and service accounts; avoid shared accounts.
- Log authentication and authorisation events and alert on anomalies such as impossible travel or unusual privilege grants.
- Protect recovery paths: help-desk resets are a frequent social-engineering target.
Common Mistakes
- Shared administrator accounts with no individual accountability.
- Access granted “just in case” and never removed.
- Service accounts with domain-wide privileges and passwords that never change.
- MFA exceptions for executives or “legacy” applications that become the attacker’s way in.
- Treating OAuth consent screens as a formality.
Practice Exercises
- Design an RBAC table for a small school system with students, teachers, administrators and parents.
- Explain the difference between OAuth 2.0 and OpenID Connect to a friend.
- List the steps a company should follow when a senior engineer resigns, in order.
- Review the third-party apps connected to your own Google, Microsoft or social media account and remove any you no longer use.
- Why does just-in-time access reduce risk compared with standing administrator rights?
Mentor tip: When investigating almost any incident, ask “whose identity was used, and why did it have that much access?” The answers usually point to the most valuable fixes.
Educational use only: practise security techniques only on systems you own or have explicit written permission to test.
- Authentication proves identity; authorisation decides permitted actions; both must be correct.
- RBAC and ABAC organise permissions; always deny by default and apply least privilege.
- SSO with SAML or OIDC reduces password sprawl; OAuth delegates limited access with tokens and scopes.
- Privileged and non-human accounts need vaulting, just-in-time access and monitoring.
- Automate joiner-mover-leaver processes and review access regularly.