← Back to Blog

RBAC vs ABAC vs ReBAC: Choosing an Authorization Model

Israfil CoskunIsrafil Coskun · Head of Growth
· 9 min read
RBAC vs ABAC vs ReBAC: Choosing an Authorization Model

A team picks an authorization model once and then lives with it for years. The choice usually gets made in an afternoon, by whoever was closest to the code, under a deadline. The exceptions start arriving about a month later.

If you are weighing RBAC vs ABAC vs ReBAC, you are at that afternoon now.

TL;DR

Role-based access control (RBAC) decides by the roles a user holds. Attribute-based access control (ABAC) decides by properties of the user, the resource and the moment. Relationship-based access control (ReBAC) decides by how the user is connected to the one specific resource in the request. Production systems rarely pick one of the three. A single request usually asks a question that each one answers best, so they use all three, each for the rules it states cleanly.

  • RBAC answers whether someone may do this kind of thing at all. Keep it as the coarse gate.
  • ABAC answers under which circumstances. It fits time, location, data classification, record age and device rules.
  • ReBAC answers which particular object. It fits ownership, sharing, teams and hierarchies.
  • The three are not rival products competing for the same slot. One request often needs an answer from all of them.
  • The decision that matters is not which model to adopt. It is which model each individual rule belongs in.

To show why, take one requirement and try to satisfy it three times. A bank has forty account managers and two thousand customers. The requirement is one sentence: an account manager may open a customer's statement. Every model below gets the same sentence to implement.

RBAC: access by role

RBAC grants permissions to roles and roles to people. Nobody holds a permission directly. The role is the unit of administration, which is what makes RBAC easy to reason about and easy to review: you can print the list.

The first implementation takes ten minutes. Create an account-manager role, grant it statement:read, assign it to all forty managers.

Then someone notices that all forty can open all two thousand statements.

The standard fix is more roles. One per branch, so a manager cannot read another branch's customers. Then private banking needs separating. Then one product line turns out to have its own confidentiality rule. Role names stop describing job functions and start encoding the cross product of every dimension that matters. We covered the mechanics in why RBAC breaks down at scale: role counts grow multiplicatively rather than additively once tenants, regions and delegation arrive.

What RBAC got right is worth keeping. It answered "may this person read statements at all" correctly, cheaply, and in a form an auditor can read. That question still needs answering whatever you add next. The mistake is asking RBAC the second question, the one about which statement.

ABAC: access by attributes

ABAC decides from properties: attributes of the user, attributes of the resource, and attributes of the request itself. Instead of enumerating who may act, you state the condition under which acting is allowed, and the condition is evaluated fresh each time.

The same requirement becomes one rule that covers all forty managers with no new roles:

allow statement:read when
  user.branch == customer.branch
  and request.time in businessHours
  and customer.segment in user.clearedSegments

This is a real gain. The branch dimension that was about to become forty roles is now one comparison, and adding a new branch requires no authorization change at all.

Then the requirement gets more specific, as requirements do. The actual bank rule is not that a manager may read customers in their branch. It is that a manager may read the customers assigned to them. Assignment is not a property of the manager or of the customer. It is a fact about the pair.

You can flatten it into an attribute. Put assignedManagerId on the customer and compare it to the user. That works, for exactly one hop. Then coverage arrives: when the assigned manager is on leave, their team lead may open the statement. Now the decision needs the manager's team, its lead, and the leave calendar, each another attribute to source and keep fresh. The policy turns into a chain of equality checks that no longer reads back as the sentence the business actually said.

That is ABAC's real cost. As our walkthrough of Keycloak Authorization Services puts it, in most real ABAC systems the attribute pipeline, not the policy language, is where the effort and the bugs concentrate. Writing the condition is the easy half. Guaranteeing that customer.segment is correct at the moment of the request is the other one.

ReBAC: access by relationship

ReBAC decides from the connections between the user and the resource. The model is a graph, the rule is a path through it, and the question is whether such a path exists.

The same requirement, stated as a relationship, is the sentence the business said:

A user may read a statement if they are assigned to the customer who owns the account the statement belongs to, or if they lead the team of someone who is.

The chain is manager → assigned-to → customer → owns → account → has → statement, and the team-lead hop is one more edge rather than the team and team-lead attributes ABAC had to source. The leave check does not go away: it stays an attribute condition riding on top, which is exactly the combination the next section is about. Because the rule follows the same path the business describes, it survives being read aloud in a review, which is the property ABAC lost.

ReBAC earns its place wherever the right to act is a fact about a pair: ownership, document and folder sharing, project membership, nested groups, and corporate structures where a parent may see its subsidiaries. Those rules become unmaintainable as roles and unreadable as attribute chains.

Its boundary is a clean one. Some rules have nothing to do with who knows whom. A statement older than ten years is archived and must not open from this screen. A request from an unrecognized device should read but not export. No relationship expresses either. Some relationship engines let a tuple carry a condition, but that condition is an attribute check, not a relationship. You can force them into the graph by inventing edges for time or device state, but that encodes circumstances as connections, the same category error as encoding branches as roles.

RBAC vs ABAC vs ReBAC side by side

The columns that matter are what the model decides by, where it is weak, and what a rule looks like when it belongs there.

Model Decides by Best for Weak at Example rule
RBAC The roles a user holds Stable job functions, coarse capability gates, access reviews Exceptions, per object rules, role counts that multiply Support agents may read tickets
ABAC Attributes of the user, the resource and the moment Circumstances: time, location, data class, record age, device Readability as rules compose, and sourcing trustworthy attributes Records may be opened only during business hours
ReBAC How the user is connected to the resource Ownership, sharing, teams, nested hierarchies, delegation Rules that no connection expresses, such as record age A project team member may edit that project's documents

Why real systems combine them

Go back to the requirement and notice that it was never one question. A single request to open a statement asks three:

  1. May this person read statements at all? That is a role.
  2. Is this an acceptable moment and an acceptable record? That is a set of attributes: business hours, a recognized device, a record inside the retention window.
  3. Is this their customer's statement? That is a relationship.

A role says what kind of thing you may do. An attribute says under what circumstances. A relationship says which particular object. One request needs all three answers, so a system that can only express one of them will push the other two somewhere worse, usually into application code where nobody can review them.

The term policy-based access control (PBAC) belongs here, and the field uses it in two ways. Broadly it covers any authorization driven by externalized policy rather than code. Narrowly, the sense that matters here, it names a policy that combines conditions from the other models and declares how their verdicts resolve: all must pass, any one is enough, or the majority decides. That choice is explicit, because "manager and business hours" and "manager or business hours" are one flag apart.

So the model question is the wrong unit. You do not pick a model for the company. You pick one per rule, and you need an engine that can hold all of them at once.

How this works with Keycloak

Keycloak gives you RBAC properly. Realm roles, client roles, composite roles and groups are a complete role model, and for a large share of services that is genuinely all that is required.

Beyond that, Keycloak Authorization Services adds resources, scopes, policies and permissions, with a decision strategy that controls how multiple policies on the same resource combine. It ships role, user, client, client-scope, group, time, regex, aggregate and js policy types. So role rules and time rules are built in, and aggregate lets you compose them.

The picture for the other two models is more qualified.

  • For ABAC, there is no built-in claim-based policy type. Rules that compare attributes of the user against attributes of the resource need a JAR-deployed JavaScript policy or a custom policy provider, and since Keycloak 26.6 those scripts run only if the server starts with the scripts feature flag. Our deep dive on Authorization Services covers the configuration and the attribute pipeline behind it.
  • For ReBAC, ownership is modeled directly: a resource can be owned by an end user, and ownerManagedAccess lets that owner share it. That covers owner-and-share, one hop. It is not traversal across teams, nested groups and hierarchies, which is what the statement rule needed.

This is where a central decision layer earns its place, as an addition to Keycloak rather than a replacement for it. Keymate Authorization keeps access rules as policies in one place, outside your code, and decides on every request what each user or service may do, enforcing that decision in the request path.

What matters here is that you do not pick one model for the whole company: each policy uses the model that fits the rule, and models can be combined, across role-based, attribute-based, policy-based, relationship-based, risk-adaptive and data-scoped rules. Your existing roles keep working, and you add attributes, relationships or risk only where roles stop being enough. The fine-grained authorization page goes into the object-level part.

Where to start

Do not start by choosing between RBAC vs ABAC vs ReBAC. Write down ten rules your system actually needs, in the words the business uses, and match each one against the example rules in the table above. Whichever row it sounds like is the model that rule belongs in.

Keep the roles. They are the part that works, and the part auditors already understand. The useful question is narrower than the model debate: which rules live in application code today because the authorization system could not express them, and what would it take to move them out?

If you want that answered against your own rules rather than a worked example, bring three of them to a demo: the ones that do not fit the model you already have.

Frequently Asked Questions

One policy per rule, not one model per company

Keymate Authorization keeps access rules as policies in one place, outside your code, and decides every request against them. Each policy uses the model that fits the rule.

Get new posts by email

New articles on Keycloak, authorization and running IAM in production.