What Is Access Control? Types, Models and Examples

Guilliano MolaireGuilliano Molaire14 min read

Access control is the process of deciding who or what may perform which action on a resource, and enforcing that decision on every request. In software it works alongside authentication (proving who is asking), its authorization rules can be written in terms of roles, attributes or relationships (the models compared below), and the same idea governs physical access to buildings. NIST’s glossary covers both meanings in one definition, describing access control as “the process of granting or denying specific requests to 1) obtain and use information and related information processing services and 2) enter specific physical facilities” (NIST CSRC glossary, Access Control, citing FIPS 201-3).

Because of that double meaning, the term can refer to door hardware as well as to software permissions. Physical access control decides who can walk into a room, and logical access control decides who can read a record, call an API or change a setting. This post is about the logical kind: the models you can choose from, how each one looks when you configure it in Keycloak, and the mistakes that put broken access control at the top of the OWASP Top 10.

Key Takeaways

  • In this post, access control covers two steps: authentication establishes who is asking, and authorization decides what they may do. Enforcing that decision on each request is part of it too.
  • The main models are DAC (owners decide), MAC (a central authority decides by labels), RBAC (permissions follow roles), ABAC (rules over attributes) and ReBAC (permissions follow relationships between users and objects).
  • A practical approach is to start with RBAC and add attribute or relationship rules where roles stop being precise enough.
  • Broken access control holds the first position in the OWASP Top 10:2025, and OWASP reports that 100% of the applications tested had some form of it (OWASP Top 10:2025, A01).

What is access control in software?

In an application, access control answers one question for every request: may this subject perform this action on this object? The subject is whoever makes the request. NIST’s glossary describes a subject as “an individual, process, or device that causes information to flow among objects or change to the system state” (NIST CSRC glossary, Subject). The object is the resource being accessed. The same glossary describes objects as including “devices, files, records, tables, processes, programs, and domains that contain or receive information” (NIST CSRC glossary, Object). The action is what the subject wants to do with the object, such as read, update or delete. NIST’s glossary, quoting SP 800-162, puts it as “the decision to permit or deny a subject access to system objects (network, data, application, service, etc.)” (NIST CSRC glossary, Access Control).

It helps to think of an access control system in three parts, using terms from NIST’s glossary. There is a policy, which is the set of rules written down somewhere (in code, in a configuration file or in an identity server). There is a decision point, which evaluates the policy for a given request. And there is an enforcement point, which NIST’s glossary describes as the component that “enforces policy decisions in response to a request from a subject requesting access to a protected object; the access control decisions are made by the policy decision point” (NIST CSRC glossary, Policy Enforcement Point, an entry the glossary sources from SP 800-162). In an application, that is the code that blocks or allows the request. A gap in the third part undermines the other two: the policy can be correct and the decision can be correct, but if one endpoint forgets to ask, the policy does not apply there.

Is access control the same as authentication?

No. NIST defines authentication as “verifying the identity of a user, process, or device, often as a prerequisite to allowing access to resources” (NIST CSRC glossary, Authentication), so its output is “this request comes from user 42.” Authorization, in NIST’s words, is “the decision to permit or deny a subject access to system objects” (NIST CSRC glossary, Authorization): it decides whether user 42 may delete invoice 1001. In this post, access control is used as the umbrella that covers both, plus the enforcement of the result.

The distinction matters in practice: in the OWASP example later in this post, an attacker reads another person’s account by changing a URL parameter, without breaking the login at all. In a Keycloak setup, users sign in through Keycloak, and the roles and claims in the access token it issues can feed authorization, either in your application or in Keycloak’s Authorization Services, which builds the identity it evaluates “based on the OAuth2 Access Token that was sent along with the authorization request” (Keycloak Authorization Services Guide, The evaluation context).

What are the main access control models?

This post covers five models: DAC, MAC, RBAC and ABAC, which NIST defines in its glossary and guidance, plus relationship-based access control (ReBAC).

  • Discretionary access control (DAC) “leaves a certain amount of access control to the discretion of the object’s owner, or anyone else who is authorized to control the object’s access” (NIST CSRC glossary, DAC, citing SP 800-192). An owner choosing which colleagues may open a file they created is an example of that discretion.
  • Mandatory access control (MAC) is the opposite: “policy decisions are made by a central authority, not by the individual owner of an object,” and users cannot change access rights (NIST CSRC glossary, MAC, citing SP 800-192).
  • Role-based access control (RBAC) is “a model for controlling access to resources where permitted actions on resources are identified with roles rather than with individual subject identities” (NIST CSRC glossary, RBAC, citing SP 800-95). You grant permissions to a role such as billing-admin, then assign people to the role.
  • Attribute-based access control (ABAC) is defined by NIST as a methodology “where authorization to perform a set of operations is determined by evaluating attributes associated with the subject, object, requested operations, and, in some cases, environment conditions against policy, rules, or relationships” (NIST SP 800-162, Guide to ABAC Definition and Considerations). A rule like “managers in the finance department may approve invoices from their own region during business hours” is ABAC.
  • Relationship-based access control (ReBAC) is a paradigm “where a subject’s permission to access a resource is defined by the presence of relationships between those subjects and resources” (Wikipedia, Relationship-based access control), for example owner of this document or member of the team that owns this folder. Google’s Zanzibar paper presents “a global system for storing and evaluating access control lists” that expresses access control policies for Google services including Calendar, Cloud, Drive, Maps, Photos and YouTube (Zanzibar: Google’s Consistent, Global Authorization System).

How do DAC, MAC, RBAC, ABAC and ReBAC compare?

The table below is a rule of thumb, drawn from the definitions above, for when each model fits and what to watch as an application grows. It is not a ranking, and the models can be combined, as the Keycloak examples below show.

Model Who decides Typical rule Pick it when What breaks at scale
DAC The resource owner “Alice shared this file with Bob” Users own their content and share it themselves Access depends on many owners’ individual choices rather than one central policy
MAC A central authority, through labels “Secret data needs Secret clearance” A central authority, not the owners, must set access Users cannot change access rights, so every change goes through the central authority
RBAC Administrators, by assigning roles “Editors can publish articles” Permissions follow job functions and the list of functions is short Role explosion: you end up with editor-eu-marketing-readonly because roles cannot express context
ABAC Policies over attributes “Same department and within business hours” Decisions depend on data about the user, the resource or the request Every decision reads attribute values, so those values have to be maintained alongside the policy
ReBAC The graph of relationships “Viewers of a folder can view its documents” Users share objects with each other, as in the Google services the Zanzibar paper names The relationships have to be stored and evaluated: the Zanzibar paper says the system “scales to trillions of access control lists”

If you are building a typical B2B application, a practical order is to start with RBAC for coarse permissions (who can reach the admin area, who can manage billing), then add ABAC or ReBAC rules for the cases that are about specific data, such as “only the owner of this record, or their manager.” See also Attribute-Based Access Control: How It Works, When to Use It.

How does each model look in Keycloak?

Keycloak offers two places to express these rules. The first is roles and groups, whose roles can appear as claims in the tokens your application receives. The second is Authorization Services, which you switch on per client by toggling “Authorization Enabled” in the client’s settings (Keycloak Authorization Services Guide, Enabling authorization services) so that Keycloak itself evaluates policies. The guide’s overview lists the mechanisms it can combine as attribute-based, role-based, user-based, context-based, rule-based and time-based access control, plus custom mechanisms through a Service Provider Interface (SPI), which is Keycloak’s plug-in system (Keycloak Authorization Services Guide, Overview).

RBAC with realm roles, client roles and groups

Keycloak has realm-level roles (Keycloak Server Administration Guide, Creating a realm role) and client roles, which a client defines for itself (Keycloak Server Administration Guide, Client roles). The same guide’s core concepts section describes a realm as managing “a set of users, credentials, roles, and groups,” and notes that “realms are isolated from one another” (Keycloak Server Administration Guide, Core concepts and terms). Composite roles bundle other roles, and groups let you assign roles to many users at once, because the members of a group get the roles mapped to that group. That lets you map roles to groups and put people in groups, rather than granting roles user by user.

With the Admin CLI (kcadm.sh), a sketch of that setup looks like this. It adapts the create roles, create groups and add-roles --gname commands from the guide’s Admin CLI section (Role operations, Group operations and Adding client roles to a group); the guide’s own add-roles --gname example assigns client roles rather than a realm role:

# Create a realm role and a group, then give the group the role
kcadm.sh create roles -r acme -s name=editor
kcadm.sh create groups -r acme -s name=editors
kcadm.sh add-roles -r acme --gname editors --rolename editor

Users you add to the editors group get the editor role through the group. Your API then checks for that role before allowing a publish. To inspect the claims a token actually carries, paste it into our JWT Token Analyzer, which decodes the header and payload in your browser. For more on roles and client scopes, read Keycloak Client Scopes Explained: What They Are vs Roles, and our RBAC feature page shows how this is managed on Skycloak.

ABAC with a JavaScript policy in Authorization Services

When a role is not precise enough, Authorization Services lets you attach policies to resources and scopes. A permission, in Keycloak’s words, “associates the object being protected with the policies that must be evaluated to determine whether access is granted” (Keycloak Authorization Services Guide, Permission). The guide’s policy chapter has a section for each built-in policy type: user, role, JavaScript, time, aggregated, client, group, client scope and regex (Keycloak Authorization Services Guide, Managing policies). For more, read Keycloak Authorization Services: Policy Types Explained.

None of those types is named “attribute”, so the example here writes the attribute rule as a JavaScript policy. The code below calls grant() only when the identity’s department attribute is finance. Because the guide describes the evaluated identity as built from the OAuth2 access token sent with the authorization request, the department value has to reach the access token as a claim for this check to see it (Keycloak Authorization Services Guide, The evaluation context).

const context = $evaluation.getContext();
const identity = context.getIdentity();
const attributes = identity.getAttributes();
const department = attributes.getValue('department');

if (department != null && department.asString(0) === 'finance') {
    $evaluation.grant();
}

The structure follows the JavaScript policy examples in the guide (Keycloak Authorization Services Guide, JavaScript-based policy), which use the same $evaluation object to read identity attributes, and the guide’s list of context attributes includes kc.client.network.ip_address and kc.time.date_time (Keycloak Authorization Services Guide, The evaluation context). Before you plan to write such a policy in the admin console, read how that same policy section says JavaScript policies are deployed to the server (Keycloak Authorization Services Guide, JavaScript-based policy). For a full setup, read Keycloak ABAC Configuration: Step-by-Step Guide, and for rules that depend on the request, read Context-Aware Access Control in Keycloak: How It Works.

When several policies apply to one permission, the decision strategy controls how they combine. The guide describes strategies such as Unanimous, where every policy must give a positive decision, and Affirmative, where at least one must (Keycloak Authorization Services Guide, Policy decision strategies). This is how you compose RBAC and ABAC, for example “has the approver role and belongs to the finance department.”

Relationship-style access with UMA resource sharing

For relationship-style access, Keycloak’s Authorization Services handle one relationship, ownership, through resource owners and User-Managed Access (UMA 2.0). The documentation has a section on resource owners (Keycloak Authorization Services Guide, Resource owners), and says that in UMA, “permission tickets are crucial to support person-to-person sharing and also person-to-organization sharing” (Keycloak Authorization Services Guide, Permission ticket).

The guide also describes a My Resources section in the account console, which lists the resources the user owns (Keycloak Authorization Services Guide, My Resources). Owner-managed sharing like this is DAC in practice: the resource owner, not an administrator, decides who else gets access. MAC, by contrast, is not among the mechanisms the guide’s overview lists (Keycloak Authorization Services Guide, Overview). For more on UMA, read Keycloak UMA 2.0: User-Managed Resource Sharing. If your product needs deep nesting (teams inside organizations inside folders), a dedicated ReBAC engine next to Keycloak is often the better fit, with Keycloak still handling who the user is.

See also Fine-Grained Authorization in Keycloak Explained.

Identity management as a service, on open source

Skycloak is a managed identity platform in the same category as Auth0 or Okta, built on real upstream Keycloak. You get SSO, MFA, SCIM and audit logs without running the servers, and you can export and self-host whenever you want.

What does broken access control look like?

Broken access control is what happens when those checks are missing or wrong. OWASP’s 2025 page defines access control as something that “enforces policy such that users cannot act outside of their intended permissions” (OWASP Top 10:2025, A01 Broken Access Control). The category is not new: the 2021 page reported that “94% of applications were tested for some form of broken access control,” with 34 weaknesses (CWEs) mapped to the category in its score table (OWASP Top 10:2021, A01 Broken Access Control). The 2025 page says the category is “maintaining its position at #1” and that “100% of the applications tested were found to have some form of broken access control” (OWASP Top 10:2025, A01).

The classic case is an insecure direct object reference (IDOR): the application takes an identifier from the request and uses it without checking that the signed-in user is allowed to see that object. The first example scenario on OWASP’s 2025 page is a query built straight from a URL parameter (OWASP Top 10:2025, A01):

pstmt.setString(1, request.getParameter("acct"));
ResultSet results = pstmt.executeQuery();

An attacker changes acct in the URL to someone else’s account number and gets their data, even though they signed in correctly. OWASP’s list of common failures also includes modifying URLs or parameters to bypass checks, missing access controls on POST, PUT and DELETE requests, privilege escalation, and tampering with tokens such as JWTs (OWASP Top 10:2025, A01).

The fixes are mostly about where and how you check:

  1. Deny by default. Anything that is not public should require an explicit grant, so a new endpoint is closed until someone writes its rule.
  2. Check on the server, on every request. Hiding a button in the UI is not access control; the API behind it must check too, including for write methods.
  3. Check ownership of the record, not just the role. “Has the customer role” is not enough to read invoice 1001; the query should also confirm the invoice belongs to this customer.
  4. Validate tokens fully. For JWT access tokens, RFC 9068 requires the resource server to check, among other things, that the issuer matches, that the audience names the resource server, that the signature is valid and that the expiry has not passed before accepting the token (RFC 9068, section 4), so do that before trusting the roles inside it.
  5. Log and alert on access control failures, and rate limit APIs so that scripted guessing of identifiers is slowed down, as OWASP recommends (OWASP Top 10:2025, A01).

Centralising rules in Keycloak helps with the first and third points, because the policy lives in one place instead of being copied into each service, but the enforcement point is still your code. Every API has to ask the question, whether it reads roles from the token or calls Keycloak’s policy evaluation.

How does access control relate to IAM and PAM?

Access control is one part of identity and access management (IAM), the wider practice that stores user identities, authenticates them and decides which applications and resources each one may use. Privileged access management (PAM) narrows that to the accounts that can change configuration, read all data or create other accounts, such as administrators and root accounts, and adds controls like credential vaulting and time-limited elevation. Our IAM vs PAM: Differences, Overlap and Which You Need First post lists those PAM capabilities and compares the two in full.

Frequently asked questions

What is the difference between access control and authentication?

Authentication verifies who is asking, and access control uses that verified identity to decide and enforce what they may do. User 42 can sign in correctly and still be refused invoice 1001 because the invoice belongs to someone else.

What is the difference between RBAC and ABAC?

RBAC grants permissions through roles assigned to users, so the question is “does this user have the role?” ABAC evaluates attributes of the user, the resource and the request against a policy, so it can express rules like “same department” or “during business hours,” which are conditions on attributes rather than on role membership.

What are the four types of access control?

The four models covered first in this post are discretionary (DAC), mandatory (MAC), role-based (RBAC) and attribute-based (ABAC) access control, each defined by NIST (linked above). Relationship-based access control (ReBAC) is a fifth model, which bases access on how a user is related to an object, such as owner or team member.

Which access control model should I use for a SaaS application?

Start with RBAC for broad permissions, because it is simple to reason about. Add attribute or ownership checks for data-level decisions, and consider a relationship-based engine only when sharing and nested resources become central to the product.

Is physical access control the same thing?

It follows the same idea of deciding who may enter and enforcing it, and NIST’s definition covers both. Physical access control governs entry to “specific physical facilities,” in NIST’s words, while logical access control governs requests to information and services in software (NIST CSRC glossary, Access Control).

What to do next

Write down the resources your application protects and the actions on each, then decide which ones a role can cover and which need an attribute or ownership rule. Put the roles and groups in your identity provider, keep data-level checks on the server for every request, and test them by trying to read another user’s records. If you want to run Keycloak without managing the servers yourself, read our Managed Keycloak overview and start a trial. If you are still choosing a model, continue with the ABAC guide and fine-grained authorization in Keycloak.

Sources

Identity management as a service, on open source

Skycloak is a managed identity platform in the same category as Auth0 or Okta, built on real upstream Keycloak. You get SSO, MFA, SCIM and audit logs without running the servers, and you can export and self-host whenever you want.

Guilliano Molaire
Written by
Founder, Skycloak

Guilliano is the founder of Skycloak and a cloud infrastructure specialist with deep expertise in product development and scaling SaaS products. He discovered Keycloak while consulting on enterprise IAM and built Skycloak to make managed Keycloak accessible to teams of every size.

© 2026 Skycloak. All Rights Reserved. Design by Yasser SolimanKeycloak™ is a trademark of the Linux Foundation. Skycloak is not affiliated with the Keycloak project.