How we built claim-level RBAC for an enterprise AI gateway

Most AI tools check who you are once, at login, and then act on your behalf through a shared service account with broad access. That is how an intern ends up with a summary of a board paper. The AI did nothing wrong. It simply had more access than the person asking.
When we designed Vorion, our enterprise AI gateway, we decided that model was not acceptable for our clients. The answer was claim-level role-based access control: a specific permission checked on every single request, and the user's own identity carried all the way into each tool call and document search.
This post is about how we actually built it, the trade-offs we accepted and what we learned shipping it to production.
Why isn't checking permissions at login enough?
The common pattern is straightforward: authenticate the user, issue a session, then let the application call APIs with a service account that can read almost everything. It works because it is simple. It fails the moment the AI starts acting on data the user cannot see.
An AI assistant does not just display data. It retrieves, summarises and reasons over it. If the retrieval layer can read more than the user can, the model will happily summarise a salary spreadsheet for someone who was never meant to open it. The leak is quiet, and nobody notices until an audit asks who accessed what.
A check once at login also goes stale immediately. If someone's role changes in the morning, their AI access should change with it, not at the next login or the next token refresh.
What does a claim-level permission look like?
In Vorion, every API route is protected by a specific permission in the form service.tag.operation. Reading a document, calling a search endpoint, invoking a tool: each is a distinct claim checked live on each request. There is no ambient "logged in" access.
We kept the format deliberately boring. Three segments, human-readable, easy to audit in a log line. An administrator can look at a user's claims and answer "what can this person do" without reading source code. That readability turned out to matter as much as the enforcement itself.
The check happens at the edge of every route, before any business logic runs. If the claim is missing, the request is rejected before it touches a model, a database or a connector. Enforcement first, always.
How does the user's identity travel into tool calls?
The harder problem is downstream. When the AI decides to call a tool or search documents, that action must carry the original user's identity, not a generic service identity. Otherwise the gateway checks the front door and leaves the back door open.
So we propagate the user's claims through the request context into every tool call. A document search is executed as that user, and results are filtered to what that user is allowed to open. If you cannot read the file in the source system, it does not appear in your answer, and it does not appear in the model's context either.
This is the part most implementations skip, and it is the part that matters most. The model never sees data outside the user's permissions, so it cannot leak what it was never shown.
What does this look like in practice?
| Concern | Check once at login | Claim-level check on every request |
|---|---|---|
| Intern asks for a board summary | Passes if session is valid | Rejected, no claim for that operation |
| Role changes at 9 a.m. | Stays stale until re-login | Effective on the next request |
| Document search | Returns what the service account sees | Filtered to the user's own permissions |
| Audit question "who accessed what" | Partial, mostly guesses | Exact, per request and per tool call |
What were the hard parts?
Latency was the first. A live permission check on every request sounds expensive, and it can be if you query a distant service each time. We keep the decision path local to the gateway and cache claims aggressively, invalidating on role changes rather than time alone. The check adds milliseconds, not seconds.
The second was filtering retrieval results. Rejecting a whole request is easy. Filtering what a vector search returns so the model never sees an unauthorised chunk is harder. We filter at query time using the user's claims, not after results come back, because post-filtering still lets sensitive text into the model's context window briefly.
The third was keeping it operable. A security mechanism nobody can reason about gets disabled. Readable claims, a clear audit trail and an append-only log of every check mean an administrator can explain any decision weeks later, which is exactly what the EU AI Act's logging expectations ask for.
What did we learn shipping it?
Start with enforcement at the edge, not in the model. The model should never be trusted to withhold information. Put the control where you can test it.
Make the permission format boring. Clever schemes are hard to audit. Three readable segments beat a flexible DSL nobody remembers.
Propagate identity all the way down. A strong check at the edge means little if the tool call underneath runs as a broad service account.
Log every decision, not just denials. Approvals are evidence too, and append-only logs make the answer to "what did the AI do" a query, not an investigation.
Frequently asked questions
Is claim-level RBAC slower than checking at login?
Slightly, per request, but the difference is a few milliseconds when claims are resolved close to the gateway. The real cost is a design you have to think about upfront, not runtime latency.
Can we use this with our existing identity provider?
Yes. The gateway maps your existing roles and groups to claims at request time, so you keep your source of truth where it already lives.
What happens when a claim check fails?
The request is rejected before it reaches a model or a system, and the denial is written to the append-only audit log with the user, the claim and the timestamp.
Does this replace document-level permissions in SharePoint or our file store?
No. It honours them. Retrieval results are filtered against the same permissions the source system enforces, so the AI never returns what you could not open yourself.
About the author
Furkan Emre Çakmakçı — Full-Stack Engineer
Furkan Emre Çakmakçı is a Full-Stack Engineer at Cognivale. He works across the Vorion platform, from API design and access control to front-end delivery, and spends most of his time turning governance requirements into working software. Before Cognivale, he built web applications and internal platforms for enterprise teams.
LinkedIn profile