RBAC, ABAC, and ReBAC are different ways to answer the same API authorization question: may this subject perform this action on this resource? RBAC answers primarily through assigned roles, ABAC through attributes and policy, and ReBAC through relationships between users, groups, resources, and parent objects.
The choice matters because authorization failures are rarely caused by missing authentication. They happen when a valid caller is permitted to access the wrong function, object, property, tenant, or delegated resource. The right model should express the application's real access rules clearly enough to test, audit, and enforce on every API request.
RBAC, ABAC, and ReBAC: Direct Definitions
Role-Based Access Control (RBAC)
RBAC assigns users or workloads to roles such as viewer, editor, billing-admin, or security-analyst. Roles imply permissions. NIST's RBAC work describes access mediated through organizational identities called roles.
Attribute-Based Access Control (ABAC)
NIST SP 800-162 defines ABAC as authorization based on evaluating attributes of the subject, object, requested operation, and sometimes the environment against policy. Examples include department, tenant, data sensitivity, device state, network zone, account tier, and time of day.
Relationship-Based Access Control (ReBAC)
ReBAC derives access from relationships such as “Alice is a member of Team A,” “Team A owns Project 7,” and “Document 42 belongs to Project 7.” Systems in the Zanzibar family represent these relationships directly and evaluate whether a permission follows from the graph.
RBAC vs ABAC vs ReBAC: Side-by-Side
| Dimension | RBAC | ABAC | ReBAC |
|---|---|---|---|
| Primary input | User/workload role | Subject, resource, action, environment attributes | Relationships among subjects and resources |
| Simple admin/viewer roles | Natural fit | Possible, often more policy than needed | Possible as relations |
| Contextual rules | Awkward without role expansion | Natural fit | Usually combined with conditions/attributes |
| Per-resource sharing | Can cause many resource-specific roles | Possible if sharing is represented as attributes | Natural fit |
| Hierarchy/inheritance | Role hierarchy exists, but resource hierarchy can be awkward | Can be expressed by policy/attributes | Natural graph traversal |
| Multi-tenant membership | Works for simple tenant roles | Strong for tenant/context constraints | Strong for organization/team/resource relationships |
| Explainability | Usually straightforward | Depends on policy complexity and attribute provenance | Depends on relation graph and inheritance |
| Data required at decision time | Role assignments | Current authoritative attributes | Current relationship tuples/graph |
When RBAC Works Well for APIs
RBAC is effective when the application has a small, stable set of job functions and permissions apply broadly. Internal admin APIs, operational tools, and simple SaaS products often start with roles such as viewer, editor, administrator, and billing manager.
subject.roles = ["billing-admin"]
request.action = "refund"
request.resource = "invoice:8291"
allow if:
"billing-admin" in subject.roles
AND action == "refund"The weakness appears when the same role means different things for different resources. “Editor of Workspace A” and “Editor of Workspace B” can lead to role-per-tenant or role-per-project proliferation. RBAC also needs additional logic for conditions like “only during business hours” or “only if the document belongs to the user's region.”
Good RBAC design
- Keep the role catalog small and aligned with stable business functions.
- Separate roles from direct object identifiers where possible.
- Do not put every exception into a new role.
- Still perform object and tenant checks after role evaluation when the resource boundary matters.
When ABAC Works Well for APIs
ABAC is useful when access depends on context that changes across requests. NIST SP 800-162 explicitly models subject, object, operation, and environmental attributes.
allow if:
subject.department == "finance"
AND subject.tenant_id == resource.tenant_id
AND resource.classification != "restricted"
AND request.action == "read"
AND environment.device_trust == "managed"This avoids creating roles such as finance-reader-managed-device-eu. Instead, policy evaluates authoritative facts at decision time.
The hard part is attribute trust
ABAC quality depends on attribute provenance, freshness, and semantics. If an API trusts a client-supplied department=finance header, the model is not secure. Attributes should come from authoritative identity, resource, policy, or environmental sources and have clearly defined ownership.
ABAC can become difficult to reason about when many policies overlap. Build decision explanations, test policy combinations, and avoid hidden default-allow behavior.
When ReBAC Works Well for APIs
ReBAC is especially useful when permission follows the resource graph: organizations contain teams, teams contain projects, folders contain documents, repositories belong to organizations, or resources are shared directly with users and groups.
Google's Zanzibar paper describes a uniform model for storing and evaluating access-control relationships across large services. Modern ReBAC implementations such as OpenFGA use relationship tuples and models to answer questions such as whether a user can view a specific document.
Relations:
user:alice member organization:acme
organization:acme owner project:phoenix
project:phoenix parent document:roadmap
Permission rule:
document viewer if
direct viewer
OR viewer of parent project
OR member of owning organizationThis is a natural way to model sharing and inheritance. It also supports reverse questions such as “which documents may Alice access?” without inventing a separate role for every object.
ReBAC is not automatically dynamic-context policy
Time, device posture, risk score, source network, and data classification may still fit better as conditions or attributes. Many relationship engines therefore combine graph-based authorization with contextual conditions.
Why Hybrid Authorization Models Are Common
A realistic SaaS API might use all three models in one decision:
The goal is not to maximize model sophistication. It is to express rules in the representation that matches the business concept:
- Use roles for stable job functions.
- Use relationships for ownership, membership, hierarchy, and sharing.
- Use attributes for context and policy constraints.
A hybrid design also avoids “role explosion,” where every combination of tenant, project, region, device, and permission becomes another role.
How to Implement API Authorization Architecture
Regardless of model, separate decision logic from enforcement clearly enough that every API path behaves consistently.
Policy administration
Define models, roles, relations, attributes, and change-control ownership. Treat authorization policy as versioned security logic.
Policy decision point
Evaluate subject, action, resource, relationships, and context. Return allow/deny plus useful decision metadata where supported.
Policy enforcement point
Place checks in API middleware/services before sensitive business operations. Fail closed when a required decision cannot be obtained safely.
Resource lookup
Load the minimum resource metadata needed to authorize, including owner, tenant, classification, or parent relationship.
Do not expect an API gateway to know everything. Gateways are excellent for authentication, scopes, routing, and broad policy. Object-level decisions often require application data or a dedicated fine-grained authorization service.
Consider consistency and caching
Authorization data changes. A removed team membership, revoked share, or changed classification should take effect within a defined window. Cache decisions only when you understand the stale-access risk, include all relevant decision inputs in the cache key, and define invalidation behavior.
How to Choose RBAC, ABAC, ReBAC, or a Hybrid
| If your dominant requirement is… | Start with… | Why |
|---|---|---|
| Small set of uniform job roles | RBAC | Simple model, clear administration, easy explanations |
| Contextual rules using trusted facts | ABAC | Attributes avoid combinatorial role creation |
| Resource sharing, groups, nested hierarchy | ReBAC | Relationships match the domain directly |
| Multi-tenant SaaS with organization/project roles | RBAC + ReBAC, often with ABAC conditions | Roles express function; relations express tenant/resource membership; attributes add context |
| Highly regulated/context-sensitive actions | ABAC + explicit relationships/roles | Policy can incorporate classification, device, purpose, geography, and identity facts |
Prototype the difficult authorization questions before selecting technology. Ask “Why may this user perform this action on this exact object?” for real cases: direct sharing, team inheritance, tenant switching, support access, delegated agents, temporary access, and revocation.
Common API Authorization Mistakes
Authenticating but not authorizing objects
A valid token does not prove access to account 8291, document 42, or another tenant's resource.
Putting authorization only in the UI
Hidden buttons and client routes are not security controls. Every sensitive API operation needs server-side enforcement.
Role explosion
Creating roles for every tenant/resource/context combination makes policy difficult to administer and audit.
Untrusted attributes
ABAC fails if the caller can set the attributes that grant access.
Stale relationship data
Removed memberships or shares that remain cached can preserve access after revocation.
Default allow on policy failure
Authorization service timeouts or missing data should not silently become permission.
OWASP API1:2023 Broken Object Level Authorization is a reminder that authorization must be evaluated on the specific object. Ammune's BOLA guide covers object-level API failure patterns in more depth.
Use Runtime Evidence to Validate Authorization Assumptions
Authorization engines make deterministic decisions from known inputs. Runtime API monitoring can reveal patterns that suggest policy or implementation gaps: one user cycling through many object IDs, a service accessing a new tenant, large response sets after a role change, or an allowed operation used in an abnormal business sequence.
| Runtime signal | Authorization question |
|---|---|
| Authenticated user accesses many unrelated objects | Are object relationships/ownership checks missing? |
| Tenant switch followed by old-tenant access | Is tenant context cached or incompletely enforced? |
| New admin endpoint used by service account | Is its role/scope too broad? |
| Access continues after membership removal | Is authorization cache stale? |
| Response contains restricted fields | Is property-level authorization missing? |
Runtime detection does not replace authorization. It provides evidence that the implemented rules match real production behavior and helps investigate when a valid identity appears to act outside the expected access graph.
API Authorization Design Checklist
- List the hardest real access questions before choosing a model.
- Use RBAC for stable business roles, not every resource/context combination.
- Use ABAC when decisions depend on authoritative subject, object, action, or environment attributes.
- Use ReBAC when access follows ownership, membership, sharing, or resource hierarchy.
- Combine models when the business rule genuinely combines these concepts.
- Keep object and tenant authorization server-side.
- Define authoritative sources for roles, attributes, and relationships.
- Use consistent PDP/PEP or equivalent decision/enforcement patterns.
- Fail closed for required decisions and define availability behavior.
- Design cache keys and invalidation around revocation requirements.
- Test direct and inherited access, revocation, tenant switching, sharing, and privileged support paths.
- Monitor runtime API behavior for authorization anomalies and sensitive-response exposure.
RBAC vs ABAC vs ReBAC FAQ
Which is better: RBAC, ABAC, or ReBAC?
There is no universal winner. RBAC fits stable roles, ABAC fits attribute/context-driven policy, and ReBAC fits resource relationships, hierarchy, and sharing. Many APIs use a hybrid.
Can ReBAC replace RBAC?
Roles can be represented as relationships in a ReBAC system, but that does not mean every application needs a relationship engine. Simple, flat role models can remain easier to operate as RBAC.
What is the biggest ABAC risk?
Attribute trust and complexity. If attributes are stale, ambiguous, or controlled by the caller, policy decisions can be wrong. Large rule sets also need strong testing and decision explanations.
Is ReBAC only for social networks?
No. It is useful wherever permissions follow relationships: organizations, teams, projects, folders, repositories, documents, devices, shared resources, delegated agents, and multi-tenant SaaS hierarchies.
Should API gateways enforce fine-grained authorization?
Gateways can enforce token validity, scopes, and broad policies. Fine-grained object authorization often requires application/resource data, so it is commonly enforced in the service or through a dedicated authorization system integrated with the service.
How does BOLA relate to these models?
BOLA occurs when the API fails to verify access to the requested object. RBAC, ABAC, ReBAC, or a hybrid can prevent it only if the model and enforcement include the specific object/tenant relationship.
Can ABAC and ReBAC be combined?
Yes. A relationship can establish that a user belongs to a project, while attributes add conditions such as managed device, region, classification, or time.
How should authorization decisions be audited?
Record subject, action, resource, tenant, decision, policy/model version, and relevant non-sensitive reason/context. Avoid logging secrets or unnecessary sensitive attributes.
Conclusion
Choose authorization models based on the shape of your permissions. Roles are strong for stable job functions, attributes for dynamic context, and relationships for ownership, hierarchy, and sharing. Keep the model as simple as the business allows, combine approaches when necessary, and enforce authorization on the exact API resource—not merely on the endpoint or token.
