Skip to content

Authorize with Authwise Access

Authwise Access is the authorization engine in the identity server. You describe what your API allows as permissions and roles, grant roles to people, groups, and applications, and your API enforces the result. This page explains the model and helps you choose how to enforce it. The pages that follow are the tasks.

Access answers one question:

Is this subject allowed to use this permission on this resource?

For example: is the person u-g54uczbi7tzv allowed to use invoices.approve on invoice/inv-9? The answer is allowed or denied, with the reason.

Everything you define belongs to an audience, the object that stands for your API. Each audience has its own catalog, and there is nothing to turn on.

ObjectWhat it isExample
PermissionOne action your API allows. You choose the name.invoices.read
RoleA named set of permissions.invoices.editor
BindingA grant: a subject holds a role on a resource.u-g54uczbi7tzv holds invoices.editor on the whole API
SubjectWho the grant is for: a user, a group, or a client, which is an application.user/u-g54uczbi7tzv
ResourceWhat the grant covers: the whole API, or one object in it.account/acc-3
ConditionAn optional expression that must be true for a binding to count.request.network == "office"

A binding can also carry an expiry time, after which it stops counting.

Roles only add. A binding grants; nothing denies. A subject can do something when at least one binding that applies grants it.

For a question about a subject, a permission, and a resource, the engine:

  1. Takes the subject and every group the subject belongs to. A role granted to a group counts for its members.
  2. Takes the resource and each resource above it, up to the whole API. A role granted on an account counts for the invoices in that account.
  3. Looks for a binding of any of those subjects on any of those resources that has not expired, whose role contains the permission, and whose condition, if it has one, is true.

If the engine finds such a binding, the answer is allowed. Otherwise it is denied.

Your API can read the decision from the access token, ask the identity server at request time, or do both.

Token claimsRuntime check
HowThe access token carries roles and permissions. Your API validates the token and matches names.Your API sends the caller’s access token to POST /v1/access:check and reads the decision.
Network call per decisionNoneOne
A revoked grant takes effectWhen the token expiresOn the next check
Grants on one resource, such as one accountNot carriedDecided
ConditionsNot carried. A conditional grant is left out.Evaluated
SizeAt most 100 roles and 500 permissions in a tokenNo limit on the catalog

Start with token claims when your API only needs to know what a caller can do across the whole API, and a delay of one token lifetime on a revoked grant is acceptable. Use the runtime check when grants differ per resource, when they carry conditions, or when a revoked grant must stop working at once. The two read the same catalog, so you can use claims for coarse decisions and the check for the fine ones.

The identity server keeps its own permissions and roles in the same model. Their namespaces are reserved, and a write that uses one is refused:

  • A permission whose name or service starts with access, audit, identity, tenancy, or tenancyadmin.
  • A role whose name starts with access, identity, tenancy, or tenant.

Name your permissions and roles after your own API, such as invoices.read and invoices.editor.

  1. Define roles and grant them.
  2. Read roles and permissions from the token, or check a permission from your API.
  3. Grant access to one resource when a grant must cover one account, project, or document instead of the whole API.