Changelog - 2026-02-16 (Updated 2026-02-25)
Authorization System & Auth Module Refactor
In one line. You can now protect routes with an authorize setting backed by role shortcuts, custom voters or a Casbin policy engine, using the same registry setup as authentication.
What changed
- Authorization on routes. Route configs and the CRUD controller factory accept
authorize, with per-route overrides andauthorize: { skip: true }. - Role shortcuts and voters.
alwaysAllowRolesandallowedRolesdecide without calling an enforcer. Voters add custom ALLOW or DENY logic. Rules are cached per request. - Casbin enforcer.
CasbinAuthorizationEnforceruses thecasbinlibrary, an optional peer dependency. - Filtered adapters.
BaseFilteredAdapterandDrizzleCasbinAdapterload user-scoped policies (read-only, raw SQL through Drizzle).CasbinRuleVariantsholds the rule-type constants. - Enforcer options live with the registration. Class, name, type and options are given together to
AuthorizationEnforcerRegistry.register(), andIAuthorizeOptionsis simplified.DefaultAuthorizationEnforcerandAbilityBuilderare removed. - Role helper.
AuthorizationRoles.SUPER_ADMIN.identifiergives'999_super-admin', andAuthorizationRoles.ADMIN.isHigherThan({ target: AuthorizationRoles.USER })compares roles by priority.
Who is affected
- Code using
IAuthenticateRouteConfig. Rename it toIAuthRouteConfig. - Code using the old
authorize: { requirement: ... }shape. Move to the new spec shape (see Breaking changes). - Everyone else. Authorization is opt-in; nothing changes until you register
AuthorizeComponent.
Breaking changes
WARNING
Custom controllers that extend IAuthenticateRouteConfig, and code that uses requirement, must be updated.
Before:
import { IAuthenticateRouteConfig } from '@venizia/ignis';
interface MyRouteConfig extends IAuthenticateRouteConfig {}
authorize: { requirement: { action: 'read', resource: 'Article' } }After:
import { IAuthRouteConfig, AuthorizationActions } from '@venizia/ignis';
interface MyRouteConfig extends IAuthRouteConfig {
authenticate?: { strategies?: TAuthStrategy[]; mode?: TAuthMode };
authorize?: IAuthorizationSpec | IAuthorizationSpec[];
}
authorize: { action: AuthorizationActions.READ, resource: 'Article' }
// or
authorize({ spec: { action: AuthorizationActions.READ, resource: 'Article' } })Terminology also changed: requirement is now spec, and abilities is now rules.
The helpers source directory packages/helpers/src/helpers/ was renamed to packages/helpers/src/modules/ (internal imports @/helpers/... became @/modules/...). Imports through @venizia/ignis-helpers are unaffected.
If you import from internal framework paths instead of @venizia/ignis, replace barrel imports with the specific file, for example @/base/controllers becomes @/base/controllers/common/types.
Details
Set up authorization in three steps:
// Step 1: global options
this.bind<IAuthorizeOptions>({ key: AuthorizeBindingKeys.OPTIONS }).toValue({
defaultDecision: 'deny',
alwaysAllowRoles: ['999_super-admin'],
});
// Step 2: register the component
this.component(AuthorizeComponent);
// Step 3: register enforcers with their options
AuthorizationEnforcerRegistry.getInstance().register({
container: this,
enforcers: [{
enforcer: CasbinAuthorizationEnforcer,
name: 'casbin',
type: AuthorizationEnforcerTypes.CASBIN,
options: {
model: { driver: CasbinEnforcerModelDrivers.FILE, definition: './security/model.conf' },
adapter: new DrizzleCasbinAdapter({ dataSource, entities: { ... } }),
cached: { use: false },
},
}],
});Add authorize to a route:
this.defineRoute({
configs: {
path: '/',
method: 'get',
authenticate: { strategies: [Authentication.STRATEGY_JWT] },
authorize: { action: AuthorizationActions.READ, resource: 'Article' },
},
handler: async (context) => { ... },
});- Check order. A route with
SKIP_AUTHORIZATIONskips everything; otherwise the user must be authenticated (401), then role shortcuts and voters can decide, and finally the enforcer evaluates (403). - CRUD factory. Use
authorize: { skip: true }on a route to skip only authorization. Every write route (create,updateById,updateBy,deleteById,deleteBy) declares its ownauthorize; a read spec is refused on them since 0.4.2.