Interface: RbacServerOptions<T, G, A>
Defined in: packages/react-router/src/server.ts:180
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | DefaultRbacTypes |
G extends string | DefaultGuardName<T> |
A extends RouteArgs | RouteArgs |
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/react-router/src/server.ts:86 |
forbiddenRedirect? | string | ((args) => string) | Redirect users without access here (302) instead of the 403. | GuardHandlers.forbiddenRedirect | packages/react-router/src/server.ts:81 |
getSubject | (args) => MaybePromise<Subject | null | undefined> | Resolves the authenticated subject of the request (a session cookie, a JWT, context.get(userContext)...). Return null / undefined for guests. | - | packages/react-router/src/server.ts:191 |
guard? | G | Guard name (e.g. web or api). Defaults to the engine's defaultGuard. | - | packages/react-router/src/server.ts:193 |
onForbidden? | GuardHandler<A> | Called when the subject lacks access. Wins over forbiddenRedirect. Default: a 403 JSON Response. | GuardHandlers.onForbidden | packages/react-router/src/server.ts:74 |
onUnauthenticated? | GuardHandler<A> | Called when there is no subject. Wins over unauthenticatedRedirect. Default: a 401 JSON Response. | GuardHandlers.onUnauthenticated | packages/react-router/src/server.ts:72 |
rbac | Rbac<T> | The RBAC engine created with createRbac(...). Its typed names flow into the guards. | - | packages/react-router/src/server.ts:186 |
team? | (args) => MaybePromise<TeamId | undefined> | Resolves the current team (only when the engine was created with teams: true). | - | packages/react-router/src/server.ts:195 |
unauthenticatedRedirect? | string | ((args) => string) | Redirect guests here (302) instead of the 401. Handy for page loaders: '/login'. A function gets the args, e.g. to keep the page: ({ request }) => /login?redirectTo=${new URL(request.url).pathname}``. | GuardHandlers.unauthenticatedRedirect | packages/react-router/src/server.ts:79 |
