How context facts affect authorization
When Oso evaluates an authorization request, it checks the policy against known facts (typically stored in Oso Cloud); if the facts are true, the request succeeds. Context facts can also satisfy policy conditions, letting you provide information that exists only at request time. If a context fact isn’t provided, Oso checks the centralized fact storage instead.Example
Consider a policy rule:request_came_from_eu
to be globally true. Instead, provide it as a context fact when appropriate:
- Node.js
- Python
- Go
- Ruby
- C#
- Java
- CLI
oso.js
When to use context facts
Use context facts when authorization depends on ephemeral or external data that isn’t part of your database. Examples:- Identity provider (IDP) claims: Roles or permissions that exist only on a user’s authentication token (e.g.
is_admin(user)
from a JWT). Context facts let you pass these values without syncing them to Oso Cloud. - Request-specific properties: Information like IP address, time of day, or location:
is_weekend(true)
orrequest_came_from_eu(true)
).
Using context facts with the Check API
All SDKs support including context facts incheck
calls. The methods are documented under Authorization Checks.
Some SDKs also let you include context facts with the local check API
.
See Local Authorization for more information.