UserIdentity

Group agentprimitives.authzed.com · Scope Cluster · Short names uid

UserIdentity is a human's credential catalog: the credentials one person has linked, keyed by their canonical SpiceDB subject, used by identityMode=userPassthrough agents through a per-session SessionUserIdentity projection.

Cluster-scoped. Reconciled by pkg/controllers/useridentity -- one reconciler for validity, one for proactive OAuth refresh. metadata.name is a deterministic hash of spec.subject rather than the subject itself, and the referenced Secrets live in the agentprimitives-identities namespace.

Spec

FieldTypeDescription
spec.credentials[]objectCredentials are the user's reusable named credentials. Same shape as AgentIdentity.Spec.Credentials. The secretRefs name Secrets in the agentprimitives-identities namespace (IdentitiesNamespace). Credential names must match what tools declare (or the runtime default — see MCPServerAuth.Credential / ToolkitEnvVar.Credential).
spec.credentials[].allowedHosts[]stringAllowedHosts scopes where this credential may be sent, as host patterns ("github.com", ".internal.example"). Matching is on the URL authority (host and port), case-insensitively; a leading "." matches one or more leading labels but never the apex, so an author who wants both lists both. It exists because destination and credential were independent fields on the same tenant-writable object with nothing tying them together: a SkillSource naming spec.repoURL: "https://attacker.example/x.git" and spec.auth pointing at a production PAT made the operator send that PAT to that host as an HTTP Basic password, reading the Secret with its own cluster-wide credentials so the actor never needed get secrets. EMPTY MEANS UNSCOPED, which is the only reading that does not break every existing credential on upgrade. That makes the field opt-in, so a caller with a stricter default enforces it itself rather than relying on this: the SkillSource controller refuses an unscoped credential for a clone outright, because there is no safe default destination for one.
spec.credentials[].federatedobjectFederated is populated when type=federated. The credential is MINTED on demand via ID-JAG from the user's enterprise identity — there is no stored access token. Valid ONLY on UserIdentity / SessionUserIdentity; rejected on AgentIdentity (bot identities have no human subject to assert).
spec.credentials[].federated.idpSecretRef *objectIdPSecretRef points at the subject-keyed IdP-identity Secret in IdentitiesNamespace (the user's refresh token).
spec.credentials[].federated.idpSecretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].federated.resource *stringResource is the identifier the IdP knows the MCP server by — the ID-JAG audience.
spec.credentials[].federated.resourceServerURL *stringResourceServerURL is the MCP server URL whose authorization server accepts the ID-JAG (leg 2 discovery target).
spec.credentials[].federated.scopes[]stringScopes are optional scopes requested at the resource AS.
spec.credentials[].githubAppobjectGitHubApp is populated when type=githubApp.
spec.credentials[].githubApp.secretRef *objectSecretRef points at the Secret the channel wizard wrote.
spec.credentials[].githubApp.secretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].name *stringName is the credential's unique identifier. It is matched against the credential names a toolkit/MCPServer declares to inject the resolved value at runtime.
spec.credentials[].oauthobjectOAuth is populated when type=oauth. The referenced Secret holds access_token, refresh_token, expires_at, token_endpoint, client_id, scope as separate keys. Key names are fixed; not configurable.
spec.credentials[].oauth.secretRef *objectSecretRef points at a Secret whose keys hold the OAuth state. Required keys (read at runtime / refresh time): access_token — current access token refresh_token — long-lived refresh token (optional) expires_at — RFC 3339 timestamp; absent → never expires token_endpoint — auth-server URL for refresh client_id — OAuth client ID used at registration scope — granted scopes (informational)
spec.credentials[].oauth.secretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].staticobjectStatic is populated when type=static.
spec.credentials[].static.secretRef *objectSecretRef points at a Secret in the same namespace as the AgentIdentity.
spec.credentials[].static.secretRef.key *stringKey is the data key within the Secret holding the value.
spec.credentials[].static.secretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].type *stringType discriminates which of the blocks below is populated. (enum: static | oauth | federated | githubApp)
spec.displayNamestringDisplayName is a human-friendly label (e.g. an email address) surfaced in CLI output and the web UI.
spec.refreshThresholdstringRefreshThreshold overrides the operator-wide default OAuth refresh threshold for this identity. No effect on type=static credentials.
spec.subject *stringSubject is the canonical SpiceDB subject of the user this catalog belongs to, e.g. "user:YWxpY2VAZXhhbXBsZS5jb20=". metadata.name is a deterministic hash of this value (see pkg/platform/identity/useridentity).
* required

Status

Status is controller-owned (observed state).

FieldTypeDescription
status.availableCredentials[]stringAvailableCredentials is the set of credential names this identity successfully provides — a convenience for the operator's passthrough gate and CLI output.
status.channelIdentities[]objectChannelIdentities is the durable directory of the channel-native identities (Slack user in a workspace, …) that map to this canonical user. One canonical user fans out to many entries — the same human has distinct external IDs across unrelated Slack workspaces/orgs. Written by channelsd (best-effort) via a status merge-patch disjoint from the credential fields the useridentity controller owns.
status.channelIdentities[].displayNamestringDisplayName is the channel-native display/real name, when known.
status.channelIdentities[].domain *stringDomain is the workspace/org scope (Slack team_id); "" for kinds without one.
status.channelIdentities[].emailstringEmail is the trusted email the channel vouched for, when known.
status.channelIdentities[].externalID *stringExternalID is the channel-native user id, e.g. a Slack user_id.
status.channelIdentities[].kind *stringKind is the channel kind, e.g. "slack".
status.conditions[]objectConditions carries Valid and Refresh; the reason constants are shared with AgentIdentity.
status.conditions[].lastTransitionTime *string (date-time)lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
status.conditions[].message *stringmessage is a human readable message indicating details about the transition. This may be an empty string.
status.conditions[].observedGenerationinteger (int64)observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. (min 0)
status.conditions[].reason *stringreason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
status.conditions[].status *stringstatus of the condition, one of True, False, Unknown. (enum: True | False | Unknown)
status.conditions[].type *stringtype of condition in CamelCase or in foo.example.com/CamelCase.
status.lastRefreshAtstring (date-time)LastRefreshAt is the most recent successful OAuth refresh.
status.observedCredentials[]objectObservedCredentials is the durable trigger state for in-flight credential revocation — see AgentIdentityStatus.ObservedCredentials for the full contract. SecretNames is unused here: a UserIdentity credential's master Secret name is derived from (identity, credential) rather than referenced by the spec.
status.observedCredentials[].fingerprint *stringFingerprint is "<type>:<secretRefName>": stable across reconciles and sensitive to both a type change (static↔oauth) and a Secret-ref rename, which is how an OAuth refresh surfaces a replaced credential.
status.observedCredentials[].name *stringName is the credential name from spec.credentials[].name.
status.observedCredentials[].secretNames[]stringSecretNames are the backing Secret names for this credential, recorded so a REMOVED credential's revoke key can be reconstructed without re-reading a spec that no longer mentions it. Empty for UserIdentity, whose backing Secret name is derived from (identity name, credential name) rather than referenced by the spec.
status.observedGenerationinteger (int64)ObservedGeneration is the spec generation this status reflects.
status.resolvedCredentials[]stringResolvedCredentials lists credential names whose Secret + key resolved.
* required