Interface: RbacServerOptions<T, G, A>
Defined in: packages/astro/src/server.ts:187
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | DefaultRbacTypes |
G extends string | DefaultGuardName<T> |
A extends AstroContext | AstroContext |
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
exposeRequirements? | boolean | Include the required roles/permissions in the default 403 body (required). Default: false (like spatie's display_permission_in_exception). | GuardHandlers.exposeRequirements | packages/astro/src/server.ts:95 |
forbiddenRedirect? | string | ((context) => string) | Redirect users without access here (302) instead of the 403. | GuardHandlers.forbiddenRedirect | packages/astro/src/server.ts:90 |
getSubject | (context) => MaybePromise<Subject | null | undefined> | Resolves the authenticated subject of the request (locals.user set by your auth middleware, a session cookie...). Return null / undefined for guests. | - | packages/astro/src/server.ts:198 |
guard? | G | Guard name (e.g. web or api). Defaults to the engine's defaultGuard. | - | packages/astro/src/server.ts:200 |
onForbidden? | GuardHandler<A> | Called when the subject lacks access. Wins over forbiddenRedirect. Default: a 403 JSON Response. | GuardHandlers.onForbidden | packages/astro/src/server.ts:83 |
onUnauthenticated? | GuardHandler<A> | Called when there is no subject. Wins over unauthenticatedRedirect. Default: a 401 JSON Response. | GuardHandlers.onUnauthenticated | packages/astro/src/server.ts:81 |
rbac | Rbac<T> | The RBAC engine created with createRbac(...). Its typed names flow into the guards. | - | packages/astro/src/server.ts:193 |
team? | (context) => MaybePromise<TeamId | undefined> | Resolves the current team (only when the engine was created with teams: true). | - | packages/astro/src/server.ts:202 |
unauthenticatedRedirect? | string | ((context) => string) | Redirect guests here (302) instead of the 401. Handy for pages: '/login'. A function gets the context, e.g. to keep the page: ({ url }) => /login?redirectTo=${url.pathname}``. | GuardHandlers.unauthenticatedRedirect | packages/astro/src/server.ts:88 |
