AuthContext
Defined in: src/auth.ts:7
Authentication context available to RPC handlers.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AuthContext( domain, authenticated, principal, claims?): AuthContext;Defined in: src/auth.ts:18
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
domain | string |
authenticated | boolean |
principal | string | null |
claims | Record<string, any> |
Returns
Section titled “Returns”AuthContext
Properties
Section titled “Properties”authenticated
Section titled “authenticated”readonly authenticated: boolean;Defined in: src/auth.ts:12
True when the request carried valid credentials.
claims
Section titled “claims”readonly claims: Record<string, any>;Defined in: src/auth.ts:16
Arbitrary verified claims about the principal (e.g. decoded JWT claims).
domain
Section titled “domain”readonly domain: string;Defined in: src/auth.ts:10
Authentication domain/realm that vouched for the principal; empty string when anonymous.
principal
Section titled “principal”readonly principal: string | null;Defined in: src/auth.ts:14
Authenticated principal identifier, or null when anonymous.
Methods
Section titled “Methods”requireAuthenticated()
Section titled “requireAuthenticated()”requireAuthenticated(): void;Defined in: src/auth.ts:31
Throw an RpcError if this context is not authenticated.
Returns
Section titled “Returns”void
anonymous()
Section titled “anonymous()”static anonymous(): AuthContext;Defined in: src/auth.ts:26
Create an unauthenticated (anonymous) context.
Returns
Section titled “Returns”AuthContext