Skip to content
On this page

Identity and access

Principals and identities

Every user, service and device account in Factory+ is a principal with a UUID, and names such as Kerberos principals map onto it.

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

A principal is anyone or anything that makes requests or holds permissions in Factory+.

Every request is made by a principal, and every permission is granted to one. A principal may be a person, a central service, an Edge Agent or a third-party application. Each principal is identified by a UUID. Permissions, ownership and configuration all refer to that UUID, whichever protocol the principal uses to sign in.

A principal is not the same thing as a login name. A person signs in with a Kerberos principal name, a browser application presents an OpenID Connect token and an Edge Agent publishes from a Sparkplug address, and all three names can belong to one principal. Factory+ therefore keeps the principal separate from its identities. The principal is the UUID, its identities are the names it is known by, and the Auth service holds the link between them.

A principal is a Configuration Store object

A principal is an object in the Configuration Store that is a member of the class Principal. The membership may be direct or through a subclass.

ClassPrincipal
11614546-b6d7-11ef-aebd-8fbb45451d7c
Every principal is a member of this rank 1 class, directly or through one of its subclasses.

Because a principal is an ordinary Configuration Store object, it has everything other objects in the object model have. Its Object Registration entry records its primary class and owner. It can have a name in the General Information app, and it can hold configuration in any other app. A principal is an individual, meaning a rank 0 object, and the classes that group principals together are rank 1 classes that are subclasses of Principal.

The authorisation model depends on this membership. An Auth service MUST NOT give an ACL to a UUID that is not a member of Principal. An account that exists in Kerberos but has no principal object can therefore authenticate to a service and still has no permissions at all.

Creating a principal

A principal is created in three steps, either by hand or by a provisioning tool.

  1. Create a Configuration Store object whose class is one of the principal types, for example Human user. Give it a name in the General Information app.
  2. Create the account in the identity provider, such as a Kerberos principal in the realm’s key distribution centre (KDC).
  3. Link the two by adding the identity to the principal in the Auth service, with PUT /v2/principal/{uuid}/kerberos.

The object created in step 1 is owned by the principal that created it, as with any Configuration Store object. Its owner matters to grants on the Mine special target, as described under Ownership.

Identities

An identity is a name by which a principal is known in one naming system. The Auth service stores each identity as a record of principal, kind and name. Two rules apply to them.

  • A principal has at most one name of each kind.
  • A name belongs to at most one principal within its kind.

These rules make the mapping work in both directions. A service can turn a Kerberos name into a principal UUID, and a client can find the Kerberos name of a principal. An attempt to give a name to a second principal fails with 409 Conflict.

Two identity kinds are defined.

KindName formatStatus
kerberosA Kerberos principal name, name@REALMIn use. It is the only kind an Auth service lists at GET /v2/identity.
sparkplugA Sparkplug Edge Node addressReserved. Sparkplug addresses are held in the Configuration Store instead, as described under Sparkplug addresses.
Identity kindKerberos
75556036-ce98-11ef-9534-637ef5d37456
The kerberos identity kind.
Identity kindSparkplug
7c51a61a-ce98-11ef-834a-976fb7c5dd4c
The sparkplug identity kind, reserved for future use.

Kerberos

A Factory+ deployment needs a Kerberos realm, because Kerberos is the identity of record for services, Edge Agents and people. Each of them has a Kerberos principal. Every service checks Kerberos credentials when they are presented, as described in Authentication. Any Kerberos implementation can provide the realm, including an existing directory service that the site already runs.

A Kerberos principal name has the form name@REALM, for example jsmith@EXAMPLE.COM or sv1directory@EXAMPLE.COM. The name part MAY contain letters, digits and the characters _, ., / and -, and these allow instance names such as nd1/cell-01@EXAMPLE.COM. Realms are conventionally upper case, but an Auth service SHOULD accept the realm as it is given and compare names exactly.

Kerberos needs keys on the server side as well as the client side. Each HTTP service holds a key for the service principal HTTP/<hostname>, and with that key it can accept Negotiate authentication and verify passwords. The MQTT broker holds a key for mqtt/<hostname>. Each service that calls other services also has a client principal of its own, and that client principal is its identity as a Factory+ principal.

Cross-realm trust

Kerberos realms can trust each other, and a principal from one realm can then authenticate to services in another. Factory+ supports this without any special handling, because a principal from a trusted realm presents an ordinary Kerberos name such as jsmith@OTHER.EXAMPLE.COM. The deployment still decides what that person may do, because the name gets permissions only once it is linked to a principal UUID in the local Auth service, in the same way as a local name. Setting up the trust itself is a Kerberos administration task and is outside the framework.

Sparkplug addresses

Many principals publish Sparkplug data, and the MQTT broker needs to know which Sparkplug Edge Node address each one may publish from. Factory+ records this in the Configuration Store rather than in the Auth service, as an entry in the Sparkplug address app on the principal’s UUID.

ApplicationSparkplug address
8e32801b-f35a-4cbf-a5c3-2af64d3debd7
The Sparkplug Edge Node address a principal publishes from.

The entry holds the group and node of the address:

{
  "group_id": "Example-Cell-01",
  "node_id": "Edge_Agent"
}

An MQTT permission template that refers to %g and %n reads this entry on the grant’s target. A single grant such as “Participate as Node on Self” therefore lets each Edge Agent publish only on its own address, as the worked example in Authorisation shows. To find the principal UUID for a Sparkplug Node address, a client searches this app for an entry with that group_id and node_id and no device_id.

OpenID Connect

A deployment MAY also let people and applications sign in through an OpenID Connect (OIDC) provider. The provider issues a JSON Web Token (JWT) that carries the principal UUID in the fp_principal_uuid claim. Services accept that token as a bearer credential. An OIDC sign-in does not create a new kind of principal. The token stands for the same principal UUID as that person’s Kerberos name, and the same grants apply whichever way they signed in.

How the provider finds the principal UUID for a user is up to the implementation. A provider that checks passwords against the Kerberos realm can look up the user’s Kerberos name in the Auth service with GET /v2/identity/kerberos/{name}. That lookup needs the Read Kerberos mappings permission on the Wildcard target. A token without fp_principal_uuid is refused. A provider with its own service accounts, for example for the OAuth client credentials flow, therefore needs a principal object for each of them.

Principal types

The framework defines a standard set of rank 1 classes for the different kinds of principal. Each is a subclass of Principal and a member of the rank 2 class Principal type. A deployment SHOULD create every principal as a member of exactly one of these classes, because then tools and people can tell what kind of account a UUID is. A deployment MAY create subclasses of them for its own purposes.

ClassPrincipal type
ae17afe0-ccff-11ef-bb70-67807cb4a9df
The rank 2 class whose members are the principal types below. It is a subclass of Principal group.
Principal typeHuman user
8b3e8f35-78e5-4f93-bf21-7238bcb2ba9d
An account for a person.
Principal typeCentral service
e463b4ae-a322-46cc-8976-4ba76838e908
The client account a central Factory+ service uses to call other services.
Principal typeEdge service
97756c9a-38e6-4238-b78c-3df6f227a6c9
An account for a service that runs at the edge and is not an Edge Agent, such as edge management or monitoring software.
Principal typeEdge Agent
00da3c0b-f62b-4761-a689-39ad0c33f864
The account an Edge Agent uses to publish Sparkplug data. It normally has a Sparkplug address.
Principal typeApplication account
69b0f40a-cd00-11ef-b490-ab964303209d
An account for an application or integration acting on its own behalf rather than for a person.
Principal typeSpecial account
6c5fda5c-cd02-11ef-b4d4-c7be8081480f
An account with a special role in the deployment, such as an administrator account used for bootstrap.

Principal groups

Grants are often given to a group of principals rather than to each one, and Factory+ uses the Configuration Store class model for this. Any subclass of Principal is a principal group. A grant to that class applies to every member of it, directly or through its own subclasses. The principal types above are principal groups, and a deployment can add its own, for example a class Line 3 operators with people as members.

The rank 2 class Principal group holds the classes of principals, with Principal itself as a member. It is the powerset of Principal in the sense of the object model. Principal type is a subclass of it.

ClassPrincipal group
c0157038-ccff-11ef-a4db-63c6212e998f
The rank 2 class of classes of principals.

Membership of a principal group is edited through the Configuration Store, with the Configuration Store’s own class membership permissions. The Auth service picks up the change from there. Authorisation explains how group grants expand.

Esc