Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 1 of 6 · Concept · 20 min · revision 2

Identity Lifecycle and Access Models

How accounts are created, changed and removed from an HR source of truth (joiners, movers, leavers and SCIM provisioning), how RBAC and ABAC decide access, and how least privilege and static and dynamic separation of duties are enforced, shown with a small runnable policy evaluator.

Contentsand lesson path

What you will learn

  • Design a role- or attribute-based access model with least privilege and separation of duties, including joiner, mover and leaver processes.

01. Why it matters

Many identity incidents need no clever exploit. An attacker signs in with an account that should not exist any more, or with one that holds far more access than its owner needs. MITRE ATT&CK lists this as T1078 Valid Accounts: real credentials make the activity look like normal work.

Two design questions decide how much damage such an account can do. The first is about time: does the account appear, change and disappear when the person joins, changes job and leaves? The second is about scope: when the account exists, what is it allowed to do, and can one person complete a risky task alone? This lesson covers both.

02. Joiners, movers and leavers

An identity is the digital record of a person or a program, such as an employee or a backup job. Identity lifecycle management keeps that record and its access in step with reality. People talk about it in three events, often shortened to JML:

  • Joiner: a new person starts. They should get the access their job needs on day one, and nothing else. This starting set is often called the birthright access of the job.
  • Mover: a person changes job, team or location. They get the access of the new job, and the access of the old job is removed.
  • Leaver: a person leaves. Their accounts are disabled on their last day, their sessions and tokens are revoked, and their access is removed from every system, not only the main directory.

Each event needs a source of truth, the one system trusted for a fact. For employees this is usually the HR system: it knows the job, the manager and the start and end dates. For contractors it may be a vendor management system. The directory (for example Microsoft Entra ID or an LDAP server) is not the source of truth for who works here. It is one of the systems that must follow the HR record.

Provisioning is the automated process that reads the source of truth and creates, changes or disables accounts in other systems. A common standard for this is SCIM, the System for Cross-domain Identity Management (RFC 7643 for the data model, RFC 7644 for the protocol). An identity provider can send a SCIM request to an application to create a user, change its groups, or set active to false when the person leaves. Automation matters because a process that depends on someone remembering an email fails on busy days.

The usual failure is not at the joiner step. It is the mover step. When someone moves, the new access is requested because they need it to work, but nobody asks for the old access to be taken away. After a few moves the person holds the access of every job they ever had. This is called privilege creep, and it is one reason access reviews exist (lesson 4).

Single sign-on (SSO) lets a user sign in once to an identity provider and reach many applications. It handles authentication, proving who you are. It does not decide authorisation, what you may do inside each application, and it does not remove an entitlement that an application stores itself. Disabling the SSO account stops new sign-ins, but local accounts and long-lived API keys need their own deprovisioning step.

03. RBAC, ABAC and role explosion

Once an identity exists, an access model decides what it may do. A permission is one allowed action on one kind of resource, such as invoice:approve.

In role-based access control (RBAC), permissions are grouped into roles that match job functions, and users are assigned roles, not raw permissions. A support agent gets the support-agent role, which includes ticket:read and ticket:comment. RBAC is easy to explain and easy to review: you can list who holds a role and what the role contains. The NIST RBAC model, later published as the ANSI INCITS 359 standard, also defines role hierarchies and separation-of-duty constraints.

RBAC struggles when the answer depends on details of the request. Suppose ticket data must stay in its region, so an agent in EMEA may read EMEA tickets but not APAC tickets. With roles alone you need support-agent-emea, support-agent-apac and so on, and then again for every seniority level and product line. This growth is called role explosion. With nearly as many roles as people, nobody knows what a role means, and reviews become box-ticking.

In attribute-based access control (ABAC) the decision is a rule over attributes: facts about the user (department, region, clearance), the resource (owner, region, classification), the action, and the context (time, device, network). The rule "allow ticket:read if user.region equals ticket.region" replaces a whole family of regional roles. NIST SP 800-162 describes ABAC in detail.

In practice most systems combine the two. Roles answer the coarse question, "is this kind of person ever allowed this kind of action?". Attribute rules then narrow it per request. ABAC does not remove the need for the lifecycle: the attributes it uses (job, region, manager) come from the same HR source of truth, so a wrong HR record still gives a wrong decision.

04. Least privilege and separation of duties

Least privilege means each identity holds only the access it needs for its current work, for only as long as it needs it. It limits what an attacker gains from one stolen account and what one mistake can break. In RBAC terms: small roles that match real jobs.

Least privilege alone does not stop every abuse. Creating a payment and approving that payment may each be a normal part of someone's job. The danger is one person holding both, because then they can commit a fraud and hide it. Separation of duties (SoD) is the rule that certain combinations must be split between different people. There are two forms:

  • Static SoD is checked when roles are assigned. Two roles are declared mutually exclusive, so the identity system refuses to give both to the same user, and an access review flags anyone who already holds both.
  • Dynamic SoD allows a user to hold both roles but checks each transaction. For example, an engineer may approve other people's deployments, but the approval step refuses a deployment whose author is the approver.

Static SoD is simpler to audit. Dynamic SoD suits small teams where people cover for each other, but every application that performs the action must enforce it.

05. A small policy evaluator

The script below is a small policy evaluator over a fixed set of people, roles and resources. It needs only Python 3.12 and its standard library. Save it as policy.py in a new folder called access-model and run it with python3 policy.py. The data has four deliberate problems: a regional rule, a person who holds two conflicting roles "for holiday cover", a mover whose old role was never removed, and a leaver whose account still exists.

Python · access-model/policy.py
"""A tiny access model: RBAC permissions, one ABAC rule, SoD and mover checks."""

# Source of truth for people: the HR system (job and region come from here).
HR = {
    "ana":  {"job": "support-agent", "region": "EMEA", "status": "active"},
    "ben":  {"job": "finance-clerk", "region": "EMEA", "status": "active"},
    "chen": {"job": "support-agent", "region": "APAC", "status": "active"},  # mover
    "dev":  {"job": "support-agent", "region": "EMEA", "status": "left"},    # leaver
}
# What each job should get on day one (the "birthright" role baseline).
BASELINE = {"support-agent": {"support-agent"},
            "finance-clerk": {"finance-clerk"}}
# Roles bundle permissions; users get roles, never raw permissions.
ROLES = {
    "support-agent":    {"ticket:read", "ticket:comment"},
    "support-lead":     {"ticket:read", "ticket:comment", "ticket:refund"},
    "finance-clerk":    {"invoice:create"},
    "finance-approver": {"invoice:approve"},
}
# Role assignments as they exist today in the directory.
ASSIGNED = {
    "ana":  {"support-agent"},
    "ben":  {"finance-clerk", "finance-approver"},  # granted "for holiday cover"
    "chen": {"support-agent", "finance-clerk"},     # old role never removed
    "dev":  {"support-agent"},                      # account not yet removed
}
# Static separation of duties: no one may hold both roles of a pair.
SOD_PAIRS = [("finance-clerk", "finance-approver")]
RESOURCES = {"T-100": {"type": "ticket", "region": "EMEA"},
             "T-200": {"type": "ticket", "region": "APAC"},
             "INV-7": {"type": "invoice", "region": "EMEA", "created_by": "ben"}}


def decide(user: str, action: str, res_id: str) -> tuple[bool, str]:
    """Lifecycle gate, RBAC (does any role grant it?), then ABAC conditions."""
    if HR[user]["status"] != "active":
        return False, f"HR status is {HR[user]['status']}"
    granting = sorted(r for r in ASSIGNED[user] if action in ROLES[r])
    if not granting:
        return False, f"no role grants {action}"
    res = RESOURCES[res_id]
    # ABAC: ticket data stays in its region (attributes of user AND resource).
    if res["type"] == "ticket" and HR[user]["region"] != res["region"]:
        return False, (f"user region {HR[user]['region']} != "
                       f"ticket region {res['region']}")
    # Dynamic SoD: checked per transaction, not per role assignment.
    if action == "invoice:approve" and res.get("created_by") == user:
        return False, "cannot approve an invoice you created"
    return True, "role " + ", ".join(granting)


def sod_conflicts(user: str) -> list[tuple[str, str]]:
    return [p for p in SOD_PAIRS if set(p) <= ASSIGNED[user]]


def stale_roles(user: str) -> set[str]:
    """Roles the user holds that their current job does not explain."""
    return ASSIGNED[user] - BASELINE[HR[user]["job"]]


if __name__ == "__main__":
    for user, action, res in [("ana", "ticket:read", "T-100"),
                              ("ana", "ticket:refund", "T-100"),
                              ("ana", "ticket:read", "T-200"),
                              ("chen", "ticket:read", "T-200"),
                              ("chen", "invoice:create", "INV-7"),
                              ("ben", "invoice:approve", "INV-7"),
                              ("dev", "ticket:read", "T-100")]:
        ok, why = decide(user, action, res)
        print(f"{user:5}{action:16}{res:6}-> {'ALLOW' if ok else 'DENY '} ({why})")
    for user in HR:
        for a, b in sod_conflicts(user):
            print(f"SoD   {user}: holds {a} + {b} -> CONFLICT")
        if stale_roles(user):
            print(f"EXTRA {user}: job {HR[user]['job']}, roles outside baseline: "
                  f"{sorted(stale_roles(user))}")
Terminal
cd access-model
python3 policy.py
Expected output
ana  ticket:read     T-100 -> ALLOW (role support-agent)
ana  ticket:refund   T-100 -> DENY  (no role grants ticket:refund)
ana  ticket:read     T-200 -> DENY  (user region EMEA != ticket region APAC)
chen ticket:read     T-200 -> ALLOW (role support-agent)
chen invoice:create  INV-7 -> ALLOW (role finance-clerk)
ben  invoice:approve INV-7 -> DENY  (cannot approve an invoice you created)
dev  ticket:read     T-100 -> DENY  (HR status is left)
SoD   ben: holds finance-clerk + finance-approver -> CONFLICT
EXTRA ben: job finance-clerk, roles outside baseline: ['finance-approver']
EXTRA chen: job support-agent, roles outside baseline: ['finance-clerk']

The first two lines are plain RBAC: ana may read a ticket because her role grants it, and may not refund one because no role she holds grants ticket:refund. The third line is the ABAC rule at work: RBAC allows the read, but the attribute check (EMEA user, APAC ticket) denies it.

chen shows privilege creep. HR says he is a support agent now, yet he can still create invoices because his old finance-clerk role is still assigned, and the evaluator allows it. Nothing is broken in the code; the data is wrong. The EXTRA line finds this by comparing his roles with the baseline for his current job.

ben holds finance-clerk and finance-approver, so the static SoD check reports a conflict. The dynamic check still stops him approving his own invoice INV-7. Having both checks is defence in depth, but the static conflict should still be fixed. dev has left; the lifecycle gate denies everything. In this small script the evaluator reads HR status directly. In a real system the provisioning process disables the account, and applications never see HR at all.

06. Check your understanding

Practice check · 3 questions

Lifecycle and access models

Three questions about where access decisions come from.

Q1. A contractor's account must stop working on their contract end date, even if nobody files a leaver request. Which design achieves this?
Q2. A company has 380 roles for 300 staff, with names such as `sales-emea-senior-readonly` and `sales-apac-junior-readonly`. What is the better redesign?
Q3. Engineers may write code and may approve deployments, but nobody may approve the deployment of their own change. Which control fits this rule?
Practice only: not graded, not saved, not evidence.

07. Apply it

The skill project asks you to define roles for three job functions. Start that design now, on paper or in a copy of policy.py:

  • Pick three jobs from an organisation you know, for example support agent, finance clerk and site reliability engineer. For each, list the permissions they need in the first week of work. That list is the birthright role.
  • Add one ABAC condition that would otherwise create role explosion, such as region, customer tier or on-call status.
  • Write down one static SoD pair and one dynamic SoD rule, and say which system would enforce each.
  • Describe the mover process for someone who moves between two of your jobs: which system notices the change, what is added, what is removed, and who confirms the removal.

08. Review prompt

Without looking back, explain: what joiner, mover and leaver each mean and which of them most often leaves stale access behind; why the HR system rather than the directory is the source of truth for employment; what SCIM's active attribute is used for; why SSO does not remove access stored inside an application; when an attribute rule is better than another role; and the difference between static and dynamic separation of duties, with one example of each.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check