Skip to main content

Interface: FilePolicyUser

Interface: FilePolicyUser

Minimal user identity passed to the policy function.

Properties

id

id: string;

Identifier of the requesting caller. For end-user HTTP requests this is the value of the x-forwarded-user header; for direct SDK calls and header-less HTTP requests (which run as the service principal), this is the service principal's ID.


isServicePrincipal?

optional isServicePrincipal: boolean;

true when the call is executing as the service principal — either a direct SDK call (appKit.files(...)) or an HTTP request that arrived without an x-forwarded-user / x-forwarded-access-token header. Policy authors typically check this first to distinguish SP traffic from end-user traffic.

The flag reflects the policy user the plugin selects, which combines the volume's effective auth mode with the headers on the incoming request. The full matrix:

Volume authPathHeadersisServicePrincipalNotes
service-principalHTTPx-forwarded-user presentfalse (or unset)Pre-OBO behavior. Policy sees the end user but the SDK call still runs as the SP.
service-principalHTTPno x-forwarded-usertrueHeaderless request — policy and SDK both run as the SP.
on-behalf-of-userHTTPvalid token + user headerfalseReal end-user execution. Policy sees the user; the SDK call also runs as the user.
on-behalf-of-userHTTPmissing token, dev-fallbacktrueOnly reachable when NODE_ENV === "development" (prod returns 401). Treated as SP traffic.
anyProgrammatic asUser(req)x-forwarded-user presentfalseasUser extracts the user; the SDK call runs as the user inside runInUserContext.

Programmatic calls without asUser(req) always set isServicePrincipal: true because no request is available to derive a user identity from. OBO volume defaults apply only to HTTP route traffic; for programmatic per-user execution, use asUser(req).

Databricks Developer Hub

Ready to ship your next agentic app in minutes?

Read docs