IAM, RBAC and ABAC
Identity and access management concepts, role-based vs attribute-based vs relationship-based access control, policy engines (OPA, Cedar), and enterprise identity governance.
IAM building blocks
- Identity lifecycle: joiner-mover-leaver processes, provisioning (SCIM), deprovisioning.
- Authentication: SSO, MFA (prefer phishing-resistant passkeys/FIDO2), adaptive/risk-based.
- Authorization: deciding what an identity can do.
- Governance: access reviews/certification, segregation of duties, privileged access management (PAM), audit.
- Identity types: workforce, customers (CIAM), partners, workloads/machines (often the largest number).
Authorization models
| Model | How | Example | Pros | Cons |
|---|---|---|---|---|
| RBAC | Permissions grouped into roles assigned to users | "Approver" can approve invoices | Simple, auditable | Role explosion for fine-grained rules |
| ABAC | Policies evaluate attributes of user, resource, action, environment | Approve if user.department == invoice.department and amount < user.limit |
Fine-grained, contextual | Harder to audit "who can access X" |
| ReBAC | Access derived from relationships (graph) | User can view a document if member of a folder shared with their team | Natural for collaboration apps | Requires a relationship store (Google Zanzibar-style) |
| PBAC | Policies as code, often combining the above | OPA/Rego, AWS Cedar | Centralized, testable | Policy engine to operate |
flowchart LR REQ[Request: user U wants to APPROVE invoice I] --> PEP[Policy enforcement point<br/>in service / gateway] PEP --> PDP[Policy decision point<br/>OPA / Cedar / custom] PDP --> ATTR[Attributes: user roles, dept, limit;<br/>invoice amount, dept; time] PDP --> PEP PEP -->|allow / deny| SVC[Business logic]
Policy as code example (Cedar)
permit (
principal in Role::"Approver",
action == Action::"approve",
resource is Invoice
)
when { resource.amount <= principal.approvalLimit && resource.department == principal.department };Open-source and managed options: Open Policy Agent (Rego), AWS Verified Permissions (Cedar), OpenFGA/SpiceDB (ReBAC, Zanzibar-inspired), Cerbos.
Least privilege in practice
- Start with no access; grant by role and need; time-bound elevated access (just-in-time).
- Separate duties for sensitive operations (create vendor vs approve payment).
- Regular access reviews; automated removal on role change.
- For cloud, use IAM Access Analyzer / Recommender to trim unused permissions.
Interview questions and answers
When would you move from RBAC to ABAC or ReBAC?
When roles multiply to express data-level rules (per region, per customer, per amount) or sharing relationships (documents, projects). Typically keep coarse RBAC for functions and add ABAC/ReBAC for data-level decisions.
Where should authorization decisions be made in microservices?
Coarse checks at the gateway; fine-grained decisions inside each service (close to the data), optionally delegating evaluation to a shared policy engine so policies are consistent and testable.