WHOAMI
Returns the principal ID of the authenticated caller. Requires a session started with access management enabled. Available in StackQL v1.0 and later.
See also:
[GROUPS] [ Access Management ]
Syntax
SELECT WHOAMI() [ AS <alias> ];
Arguments
None.
Return Value(s)
Returns the principal ID string established for the current statement. The function fails in a session started without --access.config.
Examples
Inspect the established identity
Both functions take no arguments and describe the caller that the server authenticated for this statement. whoami() returns the principal ID and groups() the caller's directory groups, so running them together is a quick check that a token or certificate maps to the expected principal before anything else is run.
SELECT whoami() AS principal, groups() AS memberships;