Skip to content

Principal and group mapping resolution

An external identity is not an Xratu actor until something says which actor it is. Two mapping layers do that: one turns an external subject into an internal actor id, the other turns external group names into internal ones. This page is how both resolve and what happens when neither matches.

Where mapping happens

flowchart LR
  subgraph TK["VERIFIED EXTERNAL TOKEN"]
    direction TB
    T1["provider, issuer"]
    T2["subject"]
    T3["group names"]
  end
  subgraph MP["MAPPING TABLES, keyed by provider and issuer"]
    direction TB
    PM[("Principal mappings<br/>subject to actor id")]
    GM[("Group mappings<br/>external to internal groups")]
  end
  subgraph EI["EFFECTIVE IDENTITY"]
    direction TB
    E1["actor id"]
    E2["union of groups"]
  end
  T1 --> PM
  T1 --> GM
  T2 --> PM
  T3 --> GM
  PM --> E1
  GM --> E2

Provider and issuer feed both tables, which is why the same subject from two issuers lands on two different rows.

Both lookups are keyed on the provider and the issuer as well as the value, so the same subject or group name from two different issuers resolves separately. An identity provider that is replaced does not silently inherit the previous one's mappings.

Principal mapping decides the actor id

A mapping for the token's provider, issuer and subject replaces the actor id derived from the token's claims. Where no mapping exists, the actor id derived from the claims stands.

That fallback is why an installation can work with no principal mappings at all and add them later: mapping changes which actor an external identity is, rather than whether it is one.

Group mapping adds to the token's groups

Resolved groups are added to the groups the token already carried, and the effective set is the sorted union:

token groups        what the identity provider asserted
mapped groups       what the mapping layer resolved
effective groups    the union, deduplicated and sorted

Mapping adds rather than replaces. An identity keeps the groups its provider asserted, and the mapping layer is where an external name is translated into the name Xratu's bindings use.

Groups become principals at authorisation time

Each group is turned into a principal alongside the actor itself, and roles are collected for all of them:

actor           alice@example.com
group:platform  from the token or the mapping layer
group:sre       from the token or the mapping layer

A group name is prefixed with group: where it does not already carry the prefix, so a binding made against a group is distinguishable from one made against an actor of the same name.

When mapping is unavailable

A mapping lookup that cannot complete leaves the identity with the groups its token carried, rather than failing the request. The identity remains authenticated and is authorised against whatever roles those groups and the actor already hold, which usually means less access rather than more.

See RBAC evaluation for how the collected principals turn into permissions.