Identity and access
Authentication
How clients prove who they are to Factory+ HTTP services and the MQTT broker, and how services answer when a check fails.
Authentication tells a Factory+ service which principal made a request.
A service needs to know the principal before it can decide whether to allow the request. Factory+ defines one set of authentication schemes that every HTTP service accepts in the same way. A client written for one service can therefore call all of them, and a principal is the same principal whichever scheme it uses. Service specifications refer to these schemes rather than repeating them.
Authentication only establishes who the caller is. What the caller may do is decided afterwards from its grants, as described in Authorisation.
Summary
All HTTP requests carry credentials in the standard Authorization header. The schemes are:
| Scheme | Credentials | Requirement |
|---|---|---|
Negotiate | A Kerberos GSSAPI token (SPNEGO) | Services MUST accept it. |
Basic | A Kerberos principal name and password, checked against the KDC | Services MUST accept it. |
Bearer (session token) | An opaque token issued by the same service’s POST /token | Services SHOULD offer it. |
Bearer (OIDC token) | A JWT from the deployment’s OpenID Connect provider, carrying fp_principal_uuid | Services MAY accept it. |
The two kinds of Bearer credential are told apart by their structure. A JWT is three base64url segments joined by dots, and its first segment decodes to a JSON header with an alg field. A session token is not in that form.
Every endpoint of a service requires authentication, including GET /ping, unless the service’s own specification says otherwise.
Kerberos
Because Kerberos is the identity of record in Factory+, every service MUST accept both Kerberos schemes.
A request authenticated with Kerberos identifies the caller by its Kerberos principal name, for example jsmith@EXAMPLE.COM. When the service needs a principal UUID, it looks the name up through the Auth service.
Negotiate
A client with Kerberos credentials, either a ticket cache or a keytab, obtains a service ticket for HTTP/<hostname>, where <hostname> is the host part of the service URL. It then sends the resulting GSSAPI token:
GET /v2/class/11614546-b6d7-11ef-aebd-8fbb45451d7c/member HTTP/1.1
Host: configdb.example.com
Authorization: Negotiate YIIC...
The exchange takes one round trip. If the service accepts the token, it MUST return its own GSSAPI token in a WWW-Authenticate: Negotiate <token> header on the response. The client SHOULD check that token to complete mutual authentication, because that proves to the client that it reached the real service.
A service needs a key for its HTTP/<hostname> principal to accept Negotiate.
Basic
A client that has a password rather than Kerberos tickets sends the principal name and password with the Basic scheme. The service checks them against the realm’s KDC. If the name has no @REALM part, the service MUST append its own realm.
When a service checks a password, it MUST also verify the ticket it obtains against its own key, as krb5_verify_init_creds does, because a password check that only asks the KDC can be fooled by a fake KDC.
A service MAY remember a successful check for a short time, to avoid a Kerberos exchange on every request from a client that polls with Basic authentication. A service that remembers checks MUST NOT store the password itself.
Because Basic authentication sends the password with every request, clients SHOULD only use it over TLS. A client that makes more than a few requests SHOULD exchange the password for a session token.
Session tokens
Because Kerberos is expensive to run on every request, a service SHOULD offer short-lived opaque session tokens. A client authenticates once to POST /token with any accepted scheme and then presents the token as a Bearer credential on later requests.
POST /token HTTP/1.1
Host: configdb.example.com
Authorization: Negotiate YIIC...
{
"token": "pXk2...",
"expiry": 1764684000000
}
expiry is the time the token stops working, in milliseconds since the Unix epoch. The token stands for the principal that requested it.
A session token is valid only on the service that issued it. A client that calls several services needs a token from each of them. A client SHOULD NOT assume that a token survives a restart of the service.
The token lifetime is implementation-defined. A service MAY refuse a token shortly before its stated expiry. If a client gets a 401 response to a token, it SHOULD treat the token as expired, request a new token and retry the request once.
OpenID Connect bearer tokens
A deployment MAY run an OpenID Connect (OIDC) provider, to let people sign in through a browser and let applications use standard OAuth flows. A service that accepts OIDC tokens MUST check each one before it trusts it:
- Fetch the provider’s discovery document (
/.well-known/openid-configuration) and the signing keys from itsjwks_uri. A service MAY fetch these when it first sees a JWT rather than at start-up. It SHOULD cache them. - Verify the signature, the issuer and the expiry.
issMUST equal the discovery document’sissuer. - Read the
fp_principal_uuidclaim. A token without it MUST be refused with401, even when its signature is valid, because it does not identify a Factory+ principal.
The principal of the request is the UUID in fp_principal_uuid. The service checks that principal’s ACL in the usual way.
An implementation MAY also check the aud claim. The same token is forwarded to other services, so an audience check that admits only one service breaks forwarding.
Claims
| Claim | Type | Meaning |
|---|---|---|
fp_principal_uuid | string (UUID) | Required. The principal the token stands for. |
fp_permissions | array of UUID strings | Optional. The permission UUIDs the principal held on the Wildcard target, in its expanded ACL, when the token was issued. |
fp_permissions is for applications outside Factory+ that cannot read the Auth service, such as a dashboard tool that maps a permission to one of its own roles. The claim is a snapshot taken when the token was issued, and it has no targets other than Wildcard. Factory+ services MUST make their decisions from the principal’s ACL and not from this claim.
Identity on onward calls
Services often call other services while handling a request. A service has two choices for the credentials it uses on those calls.
- Forward the caller’s JWT. If the incoming request carried an OIDC token, the service MAY send the same token on its onward calls. Each downstream service checks the token itself and applies the original caller’s ACL. A person can therefore never reach data through a service that they could not reach directly. Forwarding needs no token exchange.
- Use its own identity. The service authenticates as its own principal with Kerberos or a session token. A service that checks the caller’s permissions itself and then acts with its own rights MUST use its own identity. Any connection that outlives the request MUST also use the service’s own identity. A change-notify WebSocket shared between callers is one such connection.
Because requests authenticated with Kerberos or a session token cannot be forwarded, a service handling them always uses its own identity on onward calls.
Change-notify WebSockets
The change-notify interface runs over a WebSocket, which has no Authorization header. After opening the socket, the client sends one text message, Bearer <token>. The token is either a session token from the same service’s POST /token or an OIDC token. The service replies with a single text message holding a status code:
| Reply | Meaning |
|---|---|
200 | Authenticated. The client can send requests. |
400 | The message was not a Bearer credential. The service closes the socket. |
401 | The credential was refused. The service closes the socket. |
If a client receives 401 for a session token, it SHOULD fetch a new token and reconnect once.
Responses when authentication fails
A request can fail for several reasons before it reaches the endpoint’s own logic. Services use three status codes to separate them. Clients depend on the difference, so services MUST use the codes as follows.
| Status | Meaning | What the client should do |
|---|---|---|
401 Unauthorized | No credentials, an unknown scheme, or credentials that were checked and refused. The response MUST carry a WWW-Authenticate header. | Get new credentials, such as a new session token, before trying again. |
403 Forbidden | The caller was authenticated but its ACL does not allow the request. | Do not retry. The caller needs a grant. |
503 Service Unavailable | The service could not check the credentials because something it needs did not answer. That can be the KDC, the OIDC provider’s keys or another Factory+ service. | Keep the credentials and retry later. |
The split between 401 and 503 matters because clients throw away credentials on a 401. A service that answered 401 while its OIDC provider was down would make every client discard tokens that are still valid.
A service MAY answer 404 Not Found instead of 403 where telling the caller that something exists would itself reveal information. The service’s specification says where it does this.
MQTT
The MQTT broker authenticates clients when they connect. At that moment it computes the client’s MQTT access from the principal’s ACL, as described in MQTT. A change to the principal’s grants takes effect the next time it connects. The broker accepts three methods.
GSSAPI
The client connects with MQTT 5 enhanced authentication. The CONNECT packet sets the authentication method to GSSAPI. Its authentication data is a GSSAPI token for the service principal mqtt/<hostname>.
The exchange takes a single step. On success the broker returns its own GSSAPI token as the authentication data of the CONNACK. The client SHOULD check that token for mutual authentication. A client MUST create a fresh GSSAPI token for each connection, including reconnections.
Username and password
A client without Kerberos tickets connects with no authentication method and sends its Kerberos principal name and password as the MQTT username and password. The broker checks them against the KDC in the same way as HTTP Basic authentication.
OIDC token as password
A broker MAY accept an OIDC token in the password field. The broker then identifies the principal from fp_principal_uuid and ignores the username, which the client still sends. The broker checks the token in the same way as an OIDC bearer token.
Failure reason codes
| Reason code | Meaning |
|---|---|
0x86 Bad user name or password | The credentials were refused. |
0x8C Bad authentication method | The client asked for a method other than GSSAPI. |
0x89 Server busy | The broker could not check the credentials or fetch the principal’s ACL. The client SHOULD retry later with the same credentials. |