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
| Field | Type | Description |
|---|---|---|
spec.agentSession * | string | AgentSession is the name of the owning AgentSession (same namespace). metadata.name equals this value (1:1). |
spec.credentials | []object | Credentials 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 | []string | AllowedHosts 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[].federated | object | Federated 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 * | object | IdPSecretRef points at the subject-keyed IdP-identity Secret in IdentitiesNamespace (the user's refresh token). |
spec.credentials[].federated.idpSecretRef.name * | string | Name is the Secret's name, in the referring object's own namespace. |
spec.credentials[].federated.resource * | string | Resource is the identifier the IdP knows the MCP server by — the ID-JAG audience. |
spec.credentials[].federated.resourceServerURL * | string | ResourceServerURL is the MCP server URL whose authorization server accepts the ID-JAG (leg 2 discovery target). |
spec.credentials[].federated.scopes | []string | Scopes are optional scopes requested at the resource AS. |
spec.credentials[].githubApp | object | GitHubApp is populated when type=githubApp. |
spec.credentials[].githubApp.secretRef * | object | SecretRef points at the Secret the channel wizard wrote. |
spec.credentials[].githubApp.secretRef.name * | string | Name is the Secret's name, in the referring object's own namespace. |
spec.credentials[].name * | string | Name 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[].oauth | object | OAuth 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 * | object | SecretRef 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 * | string | Name is the Secret's name, in the referring object's own namespace. |
spec.credentials[].static | object | Static is populated when type=static. |
spec.credentials[].static.secretRef * | object | SecretRef points at a Secret in the same namespace as the AgentIdentity. |
spec.credentials[].static.secretRef.key * | string | Key is the data key within the Secret holding the value. |
spec.credentials[].static.secretRef.name * | string | Name is the Secret's name, in the referring object's own namespace. |
spec.credentials[].type * | string | Type discriminates which of the blocks below is populated. (enum: static | oauth | federated | githubApp) |
spec.subject * | string | Subject is the starter's canonical SpiceDB subject. |
spec.userIdentity * | string | UserIdentity is the name of the cluster-scoped UserIdentity this projection was narrowed from. |
Status
Status is controller-owned (observed state).
| Field | Type | Description |
|---|---|---|
status.conditions | []object | Conditions 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 * | string | message is a human readable message indicating details about the transition. This may be an empty string. |
status.conditions[].observedGeneration | integer (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 * | string | reason 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 * | string | status of the condition, one of True, False, Unknown. (enum: True | False | Unknown) |
status.conditions[].type * | string | type of condition in CamelCase or in foo.example.com/CamelCase. |
status.explanation | object | Explanation 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 | []object | Items is one entry per missing credential, in stable order. |
status.explanation.items[].credential * | string | Credential is the final (post-remap) credential name this row is for. |
status.explanation.items[].description | string | Description is the "what is this token" sentence. |
status.explanation.items[].title | string | Title is the user-facing service/token display name ("GitHub"). |
status.explanation.items[].why | string | Why 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.lastInteractionAt | string (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 | []string | MissingCredentials lists credential names the agent needs but the user has not linked. Empty → ready to proceed. |
status.observedGeneration | integer (int64) | ObservedGeneration is the spec generation this status reflects. |
status.parkedAt | string (date-time) | ParkedAt is when the owning session first entered AwaitingCredentials. The credential-link timeout is measured from max(ParkedAt, LastInteractionAt). |