Skip to content
GitHub

Authorization (roles)

When authentication is on, every caller also needs a role. Fleans has three roles in a hierarchy, where each includes the ones below it, and two roles that each grant one thing:

RoleWhat it is forIncludes
adminEverything: disable and enable definitions; migrate and purge instances; approve, reject and retry deploy requests; edit custom-task settings; promote to other environmentsoperator, user, deployer, debugger
operatorStart and inspect instances; send messages and signals; complete or fail activities; run external-task workersuser
userThe tasklist: list, claim, complete, fail and cancel user tasks—
deployerDeploy definitions, directly or by submitting a deploy request, and use the editor—
debuggerUse the instance page’s Debug mode (step through the journal)—

deployer and debugger add to whatever else the caller has. A token with operator and deployer can do both. deployer alone is enough for a CI pipeline that only deploys. debugger alone opens no page: the instance page needs operator, so give a person operator and debugger.

A signed-in caller with none of these roles gets 403 Forbidden from every API endpoint and an Access denied page in the Admin UI. Anonymous API calls still get 401 Unauthorized.

With authentication off, roles are not checked. Every endpoint and page stays open, as before.

Fleans reads roles from one claim of the token, Authentication:RoleClaim, default roles. Each role is a separate value of that claim (a JSON array in the token). Role names are case-sensitive: Admin is not admin. Set the same claim name on the API (Fleans.Api) and the Admin UI (Fleans.Web).

{
"Authentication": {
"Authority": "https://your-idp.example.com/realms/fleans",
"RoleClaim": "roles"
}
}

Environment variable: Authentication__RoleClaim=roles.

  • Keycloak puts realm roles under realm_access.roles, which Fleans does not read. Create realm roles admin, operator, user, deployer and debugger, then add a User Realm Role mapper to the fleans-api and fleans-web clients with Token Claim Name roles, Multivalued on, and Add to ID token, access token and userinfo on.
  • Microsoft Entra ID sends app roles in the roles claim. Define app roles with the values admin, operator, user, deployer and debugger on the app registration and assign them to users, groups or service principals.
  • Auth0 needs an Action that copies the user’s roles into a claim. If the claim name is namespaced (for example https://fleans/roles), set Authentication:RoleClaim to it.

Service accounts need a role too. A CI pipeline that deploys needs deployer. An external-task worker (Fleans__ExternalTaskWorker__AccessToken) needs operator. Another environment’s Admin UI that promotes versions here calls POST /Deployments/requests and reads /Definitions/latest and /Deployments/requests, so its client-credentials identity needs deployer and operator.

/health and /alive stay anonymous.

debugger grants no API endpoint: the debugger is part of the Admin UI.

Endpointuseroperatordeployeradmin
GET /UserTasks, GET /UserTasks/{id}✓✓✓
POST /UserTasks/{id}/claim, /unclaim, /complete, /fail, /cancel✓✓✓
POST /Execution/start, /message, /signal, /evaluate-conditions✓✓
POST /Execution/complete-activity, /fail-activity✓✓
GET /Execution/{instanceId}/activities/{activityInstanceId}/variables✓✓
GET /Instances/{id}/state✓✓
GET /Definitions, /Definitions/latest, /Definitions/{key}/instances, /Definitions/{key}/{version}/instances, /Definitions/{key}/versions/{from}/migration-preview✓✓
GET /custom-tasks, GET /custom-tasks/{taskType}✓✓
GET /Deployments/requests, /Deployments/requests/{id}, /Deployments/requests/{id}/bpmn✓✓
External-task worker gRPC service (Subscribe, CompleteTask, FailTask, …)✓✓
POST /Definitions/deploy✓✓
POST /Definitions/disable, /enable✓
POST /Instances/purge, /Instances/{id}/migrate, /Instances/migrate✓
PUT /custom-tasks/{taskType}/allowed-processes✓
POST /Deployments/requests (submit), /{id}/withdraw✓✓
POST /Deployments/requests/{id}/approve, /reject, /retry✓

Submitting a deployment request needs deployer (or admin) because, when Fleans__Deployments__RequiredApprovals is 0, the request deploys at once.

Roles only decide whether a caller may use an endpoint at all. The checks after that are unchanged:

  • User tasks. A user may call claim, but the claim still succeeds only if the caller is the task’s assignee, one of its candidate users, or in one of its candidate groups.
  • Deploy approvals. An admin may call approve, but Fleans__Deployments__ReviewerGroups and the “not the requester” rule still apply.

The side rail shows only the sections the signed-in user may open. Opening another page directly shows Access denied without going back to the identity provider.

PageNeeds
Settingssigned in (any role or none)
Workflows, process instances, an instance’s page, Deployments, Events, Knowledgeoperator
Editordeployer or admin
Custom Tasks (/admin/custom-tasks), Environments board (/deployments/environments)admin

Buttons on operator pages are hidden from callers without the role they need:

  • admin: Migrate, Promote, Disable / Enable on Workflows; Migrate on an instance page; Environments, the review note, Approve, Reject and Retry deployment on Deployments.
  • deployer or admin: New and Edit on Workflows (they open the editor); Withdraw on Deployments.
  • debugger or admin: Debug on an instance page. Without it, ?debug=true in the URL is ignored.

The Admin UI reads roles when you sign in. After a role is granted or removed in the identity provider, sign out and sign in again.

There is no tasklist page in the Admin UI yet, so a user with only the user role sees just Settings. Use the REST API for user tasks.

The MCP server (Fleans.Mcp) still only checks that a token is valid. It does not check roles yet.

SymptomLikely cause
403 on every endpoint with a valid tokenThe token has no admin, operator, user or deployer value in Authentication:RoleClaim. Decode the token and check the claim’s name and values.
403 only on deployThe caller has no deployer (or admin) role.
403 only on disable, enable, migrate or purgeThe caller is an operator. These need admin.
Admin UI shows Access denied after sign-inThe ID token or UserInfo has no role. With Keycloak, turn on Add to ID token or Add to userinfo on the roles mapper.
Roles are in the token but still 403The values differ in case (Admin), or the roles are nested, like Keycloak’s realm_access.roles. Fleans reads only one top-level claim.