Every app has its own authorization policy for its users. Scute denies by default: a user can do something only when a role they hold grants the permission for it. Nothing from another app ever applies.
Model#
| Part | What it is | Example |
|---|---|---|
| Resource | A type of object in your app, with a list of actions | document with read, edit |
| Permission | <resource>:<action>, created from a resource's actions, or a custom slug | document:edit, billing.export |
| Role | A set of permissions. A default role is held by every user of the app | editor |
| Role assignment | A user holds a role, optionally until expires_at | alice holds editor until 2026-12-31 |
| Instance | One object of a resource type, written type:key | document:42 |
| Resource role | A role held on one instance | document#owner |
| Relation | A link between two resource types | a document has a parent that is a folder |
| Relationship | A relation between two instances | folder:7 is the parent of document:42 |
A role grant can carry a condition on user.*, resource.* and context.* attributes. The grant counts only when the condition holds.
A permission can also require proof:
- requires_verification: the check answers allow_with_step_up until the user completes a challenge. Send the completed challenge's token as challenge on the next check.
- requires_approval: the check answers allow_with_approval until a reviewer approves an access request. Send the request id as approval.
Decisions#
Every check returns one of four values in decision:
| decision | allowed | Meaning |
|---|---|---|
| allow | true | Go ahead |
| allow_with_step_up | false | Allowed after the user verifies. step_up says how |
| allow_with_approval | false | Allowed after a reviewer approves. approval says what to request |
| deny | false | Not allowed. reason and explanation say why |
Test allowed, not decision !== "deny": an answer that still needs a step-up or an approval is not an allow.
Which call to use#
| Job | Endpoint | Page |
|---|---|---|
| Ask whether a user may do one thing | POST /v1/auth/:app_id/authz/check | Checks |
| Ask up to 100 questions at once | POST /v1/auth/:app_id/authz/check-batch | Checks |
| Filter a list query to the rows a user may see | POST /v1/auth/:app_id/authz/filter | Checks |
| List everything a user may do | GET /v1/auth/:app_id/authz/users/:user_id/permissions | Checks |
| Enforce at a proxy (Envoy, Traefik, NGINX) | /v1/auth/:app_id/authz/gateway | Checks |
| Define resources, permissions and roles | /v1/apps/:app_id/authz/... | Roles and permissions |
| Export, import, version and audit the policy | /v1/apps/:app_id/authz/policy/... | Policy |
| Sync your objects and how they relate | /v1/apps/:app_id/authz/instances, relationships | Objects and relationships |
| File and decide access requests | /v1/apps/:app_id/authz/requests | Access requests |
| Embed admin screens in your app | POST /v1/apps/:app_id/authz/element-tokens | Element tokens |
| Give roles from SAML or SCIM groups | /v1/apps/:app_id/authz/idp | Identity provider groups |
Credentials#
| Credential | Header | Endpoints |
|---|---|---|
| App key | Authorization: Bearer scapp_... | All server endpoints. A workspace key of the app's workspace, or of a workspace above it, works too |
| M2M token | X-Authorization: Bearer scm2m_... | Checks, filter, permissions, authorized users, objects and relationships. Reads take the token's read scope, writes take write. The check, check-batch and filter calls take read |
| Access token | X-Authorization: Bearer <access token> | The signed-in user's own /authz/me/* calls and the gateway |
A token without the scope a call needs gets 403 with error_code insufficient_scope. See Authentication and Errors.
Plan
Writes that define policy (resources, relations, resource roles, permissions, roles, routes, import and promote) need a plan with the authorization feature. Without it they return 422 with error_code feature_not_available and feature rbac. Reads, deletes, settings and role assignments stay available.