Interface: RouteGuardOptions<A>
Defined in: packages/astro/src/server.ts:99
The options every guard takes as its last argument: the handlers plus guard. They win over the defaults.
Extends
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
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 |
guard? | string | Check in this guard instead of the server's (subject.withScope({ guard })), like spatie's role:admin,api. | - | packages/astro/src/server.ts:101 |
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 |
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 |
