Changelog - 2026-10-18
login stores roles, and the sign-in extension points are protected hooks
Enhancement Behavior ChangeIn one line. login fills getRoles() from the sign-in response, and the four behaviour options of IAuthProviderOptions from 0.1.4-4 are four protected hooks of DefaultAuthProvider from 0.1.4-5: the options hold data, a subclass holds behaviour.
typescript
import { type AnyType, DefaultAuthProvider, type ISignInSession } from '@venizia/ardor';
export class AdminAuthProvider extends DefaultAuthProvider {
protected override resolveUsername(opts: { params: AnyType }) {
return opts.params.identifier.value;
}
protected override async beforeSaveSession(opts: { session: ISignInSession; params: AnyType }) {
if (!opts.session.roles.includes('admin')) {
throw new Error('[signIn] This console is for administrators');
}
}
}What changed
- Roles are stored.
{ userId, roles?, token: { value, type } }is the recommended shape of what the application'ssignInreturns.loginsaves therolesof the response, else therolesclaim of the token, wheregetRoles()reads them (@app/auth/permission). A role is a string, or an object named by itsidentifier(IGNIS's role model) or else itsname. saveAuthtakesroles.DefaultAuthService.saveAuth({ ..., roles })writes them. Called withoutroles, as a token refresh does, it leaves the stored roles alone.ISignInSessionis exported from@venizia/ardorand@venizia/ardor-kernel.- The behaviour options are gone.
IAuthProviderOptionsholds data only (paths).signInBody,signInUsername,onSignInandpersistSessionno longer exist, and a key left in an options object is a type error. - Four hooks replace them, each taking one
optsobject and able to usethisand the injected services:
| 0.1.4-4 option | Hook |
|---|---|
signInBody(params) | buildSignInBody({ params }): the IGNIS body by default; return params to post the form as it is |
signInUsername(params) | resolveUsername({ params }): params.username by default |
onSignIn({ session, params }) | beforeSaveSession({ session, params }): awaited before the session is saved; a throw or a rejection rejects login and nothing is saved |
persistSession: false | saveSession({ session, username }): authService.saveAuth by default; override it to do nothing and login still resolves |
loginis one sequence. PostbuildSignInBody, read the session, awaitbeforeSaveSession,saveSession, resolve withredirectTo. A form post to/auth/loginispaths.signInin the options plus abuildSignInBodythat returnsparams.
Who is affected
- An application that stores roles in a
loginoverride. The override can go: the roles are stored from the response. One that writes the key aftersuper.loginstill works. - An application that set one of the four options of 0.1.4-4, or whose
loginoverride refuses a user or calls another service. Move it to the matching hook in a subclass ofDefaultAuthProviderand bind the subclass underCoreBindings.DEFAULT_AUTH_PROVIDER. - Everyone else. No action needed.
Details
- The options moved again in the same release: Options hold data, behaviour lives in protected hooks describes
endpointsfolding intopathsand every hook taking anoptsobject.