Interface: RouteGuardOptions<Req>
Defined in: packages/express/src/guards.ts:68
The options every guard takes: the handlers plus guard.
guard is per guard only (like spatie's role:admin,api), not a createGuards() default: the defaults are about handlers, and the request's guard is set on the middleware. With per-guard names, tell the types which guard the requests have with createGuards<AppRbac, 'api'>().
Extends
GuardHandlers<Req>
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
Req | Request |
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
exposeRequirements? | boolean | Include the required roles/permissions in the default 403 body. Default: false (like spatie's display_permission_in_exception). | GuardHandlers.exposeRequirements | packages/express/src/guards.ts:58 |
guard? | string | Check in this guard instead of the request's (subject.withScope({ guard })), like spatie's role:admin,api. Default: the guard of the request's subject. | - | packages/express/src/guards.ts:73 |
onForbidden? | GuardHandler<Req> | Called when the subject lacks access. Default: 403 JSON. | GuardHandlers.onForbidden | packages/express/src/guards.ts:53 |
onUnauthenticated? | GuardHandler<Req> | Called when there is no subject (req.rbac is null). Default: 401 JSON. | GuardHandlers.onUnauthenticated | packages/express/src/guards.ts:51 |
