SessionUserIdentity

Group agentprimitives.authzed.com · Scope Namespaced · Short names suid

SessionUserIdentity is one session's narrowing of a user's UserIdentity catalog down to just the credentials that session's agent asked for, for identityMode=userPassthrough. It is 1:1 with its AgentSession: metadata.name equals the session name, and an owner-ref ties their lifetimes together.

Namespaced. It has no controller of its own -- pkg/controllers/agentsession builds it and server-side-applies it. status.missingCredentials is what parks the session in AwaitingCredentials, so an empty spec.credentials here means "still waiting for the user to link", not "no credentials needed".

Spec

FieldTypeDescription
spec.agentSession *stringAgentSession is the name of the owning AgentSession (same namespace). metadata.name equals this value (1:1).
spec.credentials[]objectCredentials is the subset of the UserIdentity's catalog the agent needs. Same shape as AgentIdentity.Spec.Credentials. SecretRefs name Secrets in the agentprimitives-identities namespace. Empty while the session is parked with missing credentials.
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.subject *stringSubject is the starter's canonical SpiceDB subject.
spec.userIdentity *stringUserIdentity is the name of the cluster-scoped UserIdentity this projection was narrowed from.
* required

Status

Status is controller-owned (observed state).

FieldTypeDescription
status.conditions[]objectConditions carries Ready; see SessionUserIdentityConditionReady.
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.explanationobjectExplanation is the structured per-credential description rendered to the user (one Item per missing credential). Populated by the operator's BuildExplanation; rendered by channelsd (Slack DM) and identityd (portal menu).
status.explanation.items[]objectItems is one entry per missing credential, in stable order.
status.explanation.items[].credential *stringCredential is the final (post-remap) credential name this row is for.
status.explanation.items[].descriptionstringDescription is the "what is this token" sentence.
status.explanation.items[].titlestringTitle is the user-facing service/token display name ("GitHub").
status.explanation.items[].whystringWhy is the agent-specific reason. EMPTY is meaningful: it signals "no explicit reason declared" so the render surface applies its own fallback (channelsd: LLM then static; identityd: static). A non-empty Why is rendered verbatim and never sent to the LLM.
status.lastInteractionAtstring (date-time)LastInteractionAt is bumped by identityd's heartbeat while the user is actively linking, so an in-progress link does not time out.
status.missingCredentials[]stringMissingCredentials lists credential names the agent needs but the user has not linked. Empty → ready to proceed.
status.observedGenerationinteger (int64)ObservedGeneration is the spec generation this status reflects.
status.parkedAtstring (date-time)ParkedAt is when the owning session first entered AwaitingCredentials. The credential-link timeout is measured from max(ParkedAt, LastInteractionAt).
* required