Skip to content
On this page

Identity and access

Authorisation

The Factory+ grant model, how grants expand into each principal's access control list, and how services check that list.

14 min read Edit this page
Central services
ACS implementationACS Auth serviceSee how the AMRC Connectivity Stack implements this.View on GitHub

Factory+ keeps every permission in one place, as grants held by the Auth service.

A deployment has many services, and each one decides whether a caller may make each request. If every service kept its own list of who may do what, each person would be set up again in every service and the lists would drift apart. Each service therefore asks the Auth service for the caller’s permissions and makes the decision itself.

A grant says that a principal holds a permission on a target. The Auth service expands every grant that applies to a principal into a flat access control list (ACL). The service that receives a request checks the caller’s ACL.

Grants

A grant is a record with five fields:

{
  "uuid": "6f2b0c5e-1d4a-4f43-9a0e-2b8f7c1d9e10",
  "principal": "c7a5d1f2-0b3e-4c9a-8e6d-5f4a3b2c1d0e",
  "permission": "4a339562-cd57-408d-9d1a-6529a383ea4b",
  "target": "8e32801b-f35a-4cbf-a5c3-2af64d3debd7",
  "plural": false
}
FieldMeaning
uuidThe grant’s own UUID. The Auth service assigns it when the grant is created. It identifies the grant for later changes and is not a Configuration Store object.
principalThe principal the grant is for, or a principal group. A principal group is a subclass of Principal.
permissionThe permission granted, or a permission group. A permission group is a subclass of Permission.
targetThe object the permission applies to, a class of objects, or one of the special targets below.
pluralfalse if the target is the object itself. true if the target is a class and the permission applies to each of its members.

A grant reads as “this principal holds this permission on this target”. The example above gives one principal the Configuration Store permission Read config for app on the Sparkplug address app. Its grant and principal UUIDs are examples. The same principal, permission and target can be granted twice, once with plural set to false and once with it set to true, and the two grants mean different things.

All UUIDs in a grant MUST be valid UUIDs, and plural MUST be a boolean. The Auth service does not check that the principal, permission and target exist when a grant is created. A grant that refers to something unregistered is stored and has no effect until that thing is registered.

Allow only, deny by default

Grants only allow, and there are no deny grants. A principal may do exactly what its grants allow and nothing else. A service MUST refuse any request that the caller’s ACL does not allow. Access is removed by deleting the grant that gave it, or by removing the principal from the group the grant was given to.

Permissions

A permission is a UUID whose meaning is defined by the service that checks it. The service’s specification says what each of its permissions allows and what kind of object its target is. For example, the Configuration Store’s Read config for app permission takes an application UUID as its target. The Auth service’s Manage ACLs permission takes a permission UUID as its target.

A permission MUST be registered in the Configuration Store as a member of the class Permission, and grants of an unregistered permission are ignored.

ClassPermission
8ae784bb-c4b5-4995-9bf6-799b3c7f21ad
Every permission is a member of this class. Its subclasses are permission groups.

How grants expand into an ACL

The Auth service turns the grants into an ACL for each principal. An ACL is a list of {permission, target} pairs with every group expanded:

[
  {
    "permission": "4a339562-cd57-408d-9d1a-6529a383ea4b",
    "target": "8e32801b-f35a-4cbf-a5c3-2af64d3debd7"
  },
  {
    "permission": "a1314953-8226-44f4-8a3e-e87b09310579",
    "target": "c7a5d1f2-0b3e-4c9a-8e6d-5f4a3b2c1d0e"
  }
]

The ACL holds only individual permissions and concrete targets or the Wildcard. A service can therefore check it without knowing anything about classes. The Auth service builds it from the grants and the current class memberships in the Configuration Store, in the steps below. When a grant or a class membership changes, the ACL changes with it.

  1. The principal must be a principal. If the UUID is not a member of Principal, it has no ACL.
  2. Select the grants for the principal. A grant applies if its principal is the principal’s own UUID. It also applies if its principal is a subclass of Principal that has the principal as a member, directly or through further subclasses. Principal itself counts as such a subclass.
  3. Expand the permission. If the grant’s permission is a member of Permission, it is used as it is. If it is a subclass of Permission, the grant becomes one entry for each member of that class. Otherwise the grant is dropped.
  4. Expand the target. If plural is false, the target is used as it is. If plural is true, the grant becomes one entry for each member of the target class, directly or through subclasses. A plural grant on Mine is the exception, and becomes one entry for each object the principal owns. A plural grant on a class with no members produces no entries.
  5. Replace Self. Any target equal to Self is replaced with the principal’s own UUID.

The result MAY contain the same pair more than once. Services MUST NOT depend on it being free of duplicates.

Principal groups

A grant to a principal group gives the permission to every member of the group. A principal group is any subclass of Principal. Membership of a principal group is recorded in the Configuration Store.

For example, a deployment creates a class Line 3 operators as a subclass of Principal and makes two people members of it. It grants the class Read config for app on the Sparkplug address app with plural set to false. Both people’s ACLs then contain:

permissiontarget
Read config for appSparkplug address app

If a third person is added to the class in the Configuration Store, their ACL gains the same entry without any change to the grants. A grant to Principal itself applies to every principal in the deployment.

Composite permissions

A permission group is any subclass of Permission. Granting the group grants each of its member permissions on the same target. A set of permissions that are always given together can therefore be granted with one grant.

The framework defines two kinds of permission group. Both are rank 2 classes that are subclasses of Permission group:

  • A composite permission is a group of permissions from any services, made to be granted together for one job. For example, a composite permission Edge monitor for agent might hold the MQTT permission Read Node and the two Command Escalation permissions Reload Edge Agent config and Rebirth.
  • A service permission set is the group of all the permissions one service defines. Its main use is to let that service read the ACL entries it needs.
ClassPermission group
ac0d5288-6136-4ced-a372-325fbbcdd70d
The rank 2 class of classes of permissions, with Permission as a member.
ClassComposite permission
1c567e3c-5519-4418-8682-6086f22fbc13
The rank 2 class of permission groups made to be granted together.
ClassService permission set
b7f0c2f4-ccf5-11ef-be77-777cd4e8cb41
The rank 2 class of permission groups that each hold all the permissions of one service.

If Edge monitor for agent is granted to a monitoring account on the target T, that account’s ACL contains three entries:

permissiontarget
Read NodeT
Reload Edge Agent configT
RebirthT

Plural targets

A plural grant applies a permission to every member of a class, including members added later. For example, a grant of the Configuration Store’s Read config for app on the class of all applications with plural set to true gives read access to every application’s configuration. It produces one ACL entry per application.

Plural grants also matter when the target is itself a group of permissions. A service that needs to read other principals’ ACLs is granted Read ACLs on its own service permission set with plural set to true. That grant expands to one Read ACLs entry for each of the service’s permissions. The Auth service checks these entries when it filters the ACL. With plural set to false, the same grant would name the class UUID itself as the target. Because the class UUID matches no permission, the grant would allow nothing.

Special targets

Four well-known UUIDs have a special meaning in the target of a grant. The expansion steps above mean that each one works with only one value of plural.

TargetpluralExpands to
WildcardfalseItself. The service that checks the ACL decides what it matches.
SelffalseThe principal’s own UUID.
MinetrueEvery object the principal owns.
Unownednot used in grantsMarks objects that have no owner.
SpecialWildcard
00000000-0000-0000-0000-000000000000
The null UUID. As a target it means all targets, or no particular target.
SpecialSelf
5855a1cc-46d8-4b16-84f8-ab3916ecb230
Replaced with the principal's own UUID when the ACL is built.
SpecialMine
724c0316-4cfd-11f0-b355-0b70840faae8
On a plural grant, expands to every object the principal owns.
SpecialUnowned
091e796a-65c0-4080-adff-c3ce01a65b2e
The owner recorded for an object that has no owner.

Wildcard

The Wildcard is the null UUID. The Auth service leaves it in the ACL as it is, and the service checking the ACL decides what it means. By convention it has one of two meanings. Each service’s specification says which meaning applies to each of its permissions:

  • All targets. The permission applies to every target the service manages. A service checking such a permission accepts an entry whose target is either the requested target or the Wildcard.
  • No target needed. Some permissions do not apply to any particular object, such as permission to list all objects. These are granted and checked with the Wildcard as the target.

A Wildcard grant MUST have plural set to false. A plural grant on the Wildcard would be expanded as a class. The null UUID has no members, so that grant would produce no entries.

Self

A grant on Self gives each principal the permission on its own UUID. It is most useful in a grant to a group, because one grant then gives every member a permission on itself and on nothing else.

For example, the MQTT permission Participate as Node takes a principal as its target. It lets the client publish as the Sparkplug Edge Node recorded in that principal’s Sparkplug address entry. A deployment grants it on Self to a group Sparkplug Node. An Edge Agent in that group with the principal UUID c7a5d1f2-0b3e-4c9a-8e6d-5f4a3b2c1d0e then has this entry in its ACL:

permissiontarget
Participate as Nodec7a5d1f2-0b3e-4c9a-8e6d-5f4a3b2c1d0e

Each Edge Agent may therefore publish on its own Sparkplug address and on no other, from a single grant.

Mine

A plural grant on Mine gives the principal the permission on every object it owns. When the Auth service builds the ACL, it looks up the objects owned by the principal whose ACL it is building, even when the grant was given to a group. A grant to Principal of a read permission on Mine therefore lets every principal read the objects it owns, and not each other’s.

Ownership, Mine and Unowned

Every Configuration Store object has an owner. The owner is recorded in the owner field of the object’s Object Registration entry. When a principal creates an object, the Configuration Store records that principal as the owner unless the request names another. An object explicitly given to Unowned has no owner, and Mine never covers it.

Ownership is part of the object model and is changed through the Configuration Store. A change needs the Configuration Store permissions Take ownership from on the current owner and Give ownership to on the new owner. Every principal may take ownership from itself, and give ownership to itself or to Unowned, without a grant.

A combined example

Suppose a principal P is a member of the group Line 3 operators, owns two objects O1 and O2, and these grants exist:

Grant toPermissionTargetplural
PRead config for appSparkplug address appfalse
Line 3 operatorsEdge monitor for agent (composite)Wildcardfalse
PrincipalRead config for appMinetrue
Sparkplug NodeParticipate as NodeSelffalse

The first grant applies directly, the second through group membership and the third because every principal is a member of Principal. The fourth does not apply, because P is not a member of Sparkplug Node. The ACL of P is:

permissiontarget
Read config for appSparkplug address app
Read NodeWildcard
Reload Edge Agent configWildcard
RebirthWildcard
Read config for appO1
Read config for appO2

How a service makes a decision

The Auth service does not decide whether a request is allowed. It computes and serves ACLs, and each service checks each caller’s ACL against its own permissions. The meaning of every permission therefore stays inside the service that defines it.

sequenceDiagram
    participant C as Client
    participant S as Service
    participant A as Auth service
    C->>S: Request with credentials
    S->>S: Authenticate the caller
    S->>A: GET /v2/acl/kerberos/{upn} or /v2/acl/{uuid}
    A-->>S: [{permission, target}, ...]
    S->>S: Check (permission, target), allowing Wildcard where the permission does
    S-->>C: Response, or 403

A service handling a request MUST:

  1. Authenticate the caller. This gives a Kerberos principal name or, for an OIDC token, a principal UUID.
  2. Fetch the caller’s ACL from the Auth service, with GET /v2/acl/kerberos/{upn} for a Kerberos name or GET /v2/acl/{uuid} for a principal UUID.
  3. Allow the request only if the ACL contains an entry with the required permission and either the requested target or, if this permission accepts it, the Wildcard.

A service MAY cache ACLs. A service SHOULD subscribe to the ACLs it holds through change-notify, on the paths v2/acl/{principal} and v2/acl/kerberos/{upn}. A revoked grant then takes effect promptly. If a service cannot reach the Auth service, it SHOULD answer 503 rather than 403, because without the ACL it cannot make a decision.

An unknown Kerberos name gets an empty ACL rather than an error. A service therefore does not need to treat it as a special case. A UUID that is not a principal gets 404, and a malformed UUID or Kerberos name in the path gets 410.

Reading ACLs

Reading ACLs is controlled, because an ACL shows what a principal can reach. The Auth service filters the ACL it returns by the caller’s Read ACLs permission, whose target is a permission. The caller sees only the entries whose permission it holds Read ACLs on. A caller with Read ACLs on the Wildcard sees the whole ACL, and a caller with no Read ACLs at all gets 403.

A service therefore learns only the parts of a caller’s access that concern it. Each service is granted Read ACLs on its own service permission set with plural set to true, as in Plural targets, and then sees exactly the entries for its own permissions.

A principal may always read its own ACL at GET /v2/whoami/acl, without Read ACLs. A client application uses this to offer only the actions its user is allowed to take:

{
  "principal": "c7a5d1f2-0b3e-4c9a-8e6d-5f4a3b2c1d0e",
  "root": false,
  "acl": [
    {
      "permission": "4a339562-cd57-408d-9d1a-6529a383ea4b",
      "target": "8e32801b-f35a-4cbf-a5c3-2af64d3debd7"
    }
  ]
}

principal is null and acl is empty when the caller has no principal UUID. root is described below.

PermissionRead ACLs
ba566181-0e8a-405b-b16e-3fb89130fbee
Read the ACL entries for the target permission. The Wildcard target allows reading all entries.

Managing grants

Grants are created, changed and deleted through the endpoints of the Auth service. Manage ACLs controls these changes. Its target is the permission whose grants the caller may manage, or the Wildcard for all permissions.

PermissionManage ACLs
3a41f5ce-fc08-4669-9762-ec9e71061168
Create, change and delete grants of the target permission. The Wildcard target allows managing all grants.

Manage ACLs is scoped by permission only:

  • Creating a grant needs Manage ACLs on the grant’s permission.
  • Reading or deleting a grant needs Manage ACLs on its permission.
  • Changing a grant needs Manage ACLs on both its current permission and its new permission.
  • Listing or searching grants returns only the grants the caller may manage.

The principal and the target of a grant are not restricted. A caller that may manage grants of a permission can therefore grant it to any principal on any target. This makes Manage ACLs on a powerful permission itself powerful. Granting a composite permission or a permission set needs Manage ACLs on the group’s own UUID, not on its members.

Group membership is not managed through grants. Adding a principal to a principal group, or a permission to a composite permission, is a change to a Configuration Store class, and the Configuration Store’s own class membership permissions control that change.

Root principal and bootstrap

The Auth service reads groups, permissions and ownership from the Configuration Store, and the Configuration Store asks the Auth service for its callers’ ACLs. Neither can work fully until the other is running. An implementation needs a way out of this loop when a deployment is first set up. It MAY provide one or both of the following:

  • A root principal is a single principal that passes every permission check in every service. It is used to load the first data. The Auth service reports it as "root": true in GET /v2/whoami/acl, because its access does not appear in its ACL.
  • Bootstrap ACL entries are fixed {permission, target} entries given to particular service accounts in their configuration. Those services use them before the Auth service is reachable. They are not group-expanded.

An implementation SHOULD keep the root principal for setup and recovery only, and use grants for everything else, because nothing in the grant model limits what the root principal can do.

Esc