Repository navigation
v2.21.0
[2.21.0] — 2026-11-12
Minor release from ten consumer requests about sign-in: a panel that signs in only through SSO, including through another Martis panel. It fixes external_id matching, stops publishing the auth config to the browser, and adds a signed-token provider, session limits and revocation for SSO sessions, a switch for password sign-in, a challenge (captcha) hook and configurable toast lifetimes. Four behaviours change without any config: read Upgrading to v2.21.0. Republish the assets (php artisan martis:publish-assets), the config and the extension shims.
Security
window.MartisConfig.authis an allow-list. The login page, which is public, received the wholemartis.autharray: every SSO provider block (role maps, tenant ids, logout URLs, any key an app added), column names and broker names. Only the keys the SPA reads are published now (Martis\Auth\PublishedAuthConfig); of a provider block onlyenabled,label,iconand the keys it lists in a new optionalpublicarray, and only for enabled providers. The other blocks of the page shell (theme,search,notificationsand so on) are still published whole.- An empty external id no longer matches a local row. With
identity_match_attribute = external_id, an identity whose id was empty matched a row whose id column was empty. It is refused (missing_external_id). - An SSO callback path in another letter case is a 404.
/sso/AZURE/callbackloaded the provider but read its settings under the name as typed, so the defaults applied (email matching, no session limit). - An
on_no_role_matchvalue other thandeny,guestorcallablethrows, naming the key. It used to sign the user in with no role.
Added
- Signed token between two Martis apps.
driver => 'signed-token'in a provider block signs a panel's users in through another Martis panel with one redirect and a 60-second, one-time PASETOv4.publictoken (Ed25519,ext-sodium, no new dependency). The consumer (Martis\Sso\Providers\SignedTokenProvider) checks the signature against every configured public key (rotation), issuer, audience, expiry, age, an optional environment lock, thestatekept in the session and a one-timejti, each refusal with its own reason. The issuing panel enablesmartis.auth.sso.issuerand servesGET /{martis}/sso/issue/{audience}behind the full panel stack: it redirects only to the audience's configuredcallback_url, can require a gate ability per audience (ability), refuses during an impersonation and carriesemail_verified.Martis\Sso\SignedToken\TokenIssuer,php artisan martis:sso:keys,martis:sso <name> --driver=signed-tokenandmartis:sso <audience> --issuer. See SSO, section 18. - Reason for a refused SSO callback.
Martis\Sso\SsoException(reason, optionalmessageKeyshown on the login page), eventMartis\Events\SsoFailed(provider, reason, exception) and a log line withprovider,reason,request_id,exceptionand a message with credentials masked. Every refusal has a reason; a plain exception isunknownand keeps the generic text. - SSO hooks accumulate.
MartisSso::afterLogin($callback, provider: 'azure')appends and can be limited to a provider;onNoRoleMatchUsing()takes a provider too (provider-specific wins over global);MartisSso::forgetHooks(); eventMartis\Events\SsoLoggedIn(user, identity, provider) once per sign-in. - SSO session limits. Per provider
max_session_minutes(an SSO session older than that goes through the provider again: 401 withsso_reauth_urlfor JSON, a redirect otherwise) andrevalidate_every_minuteswith theMartis\Sso\Contracts\RevalidatesSessionscontract (stillValid($user, $externalId)).MartisSso::revokeFor($userId)ends a user's SSO sessions on every session driver, cycles the remember token and, on thedatabasedriver, deletes the session rows.logout_urlmay be an invokable class. Middlewaremartis.sso.sessionjoins the authenticated stack. - Switch for password sign-in.
martis.auth.password_login.enabled(MARTIS_PASSWORD_LOGIN_ENABLED, defaulttrue): off, the login page shows the SSO buttons only,POST /loginandPOST /api/auth/loginanswer 403 before the controller, and password reset is off.break_glass_emailslists addresses that may still sign in with a password (form at?password_login=1); every other outcome is the same 403. A warning is logged when the panel is left with no way in. - Challenge (captcha) hook.
martis.auth.challenge(enabled,verifier,site_key,applies_to) and theMartis\Contracts\ChallengeVerifiercontract: middlewaremartis.challenge:<surface>on the login, forgot, reset, magic-link, register and invitation POST routes refuses with 422 when the verifier says no or fails (fail closed). The forms render the component registered asauth:challengeand send its token aschallenge_token;useAuthChallenge,AuthChallengeandAuthChallengePropsare exported from@martis/runtime. A Cloudflare Turnstile example is in Authentication. - Toast lifetime.
martis.toast.durationsper severity in milliseconds (null= until closed; defaults unchanged at 5000) and per calladdToast(type, message, { life, dismissOnNavigate }). - The SPA follows the intended URL after sign-in. The login, 2FA challenge and forced password change responses carry
intended_url(a same-origin path under the panel only), so a visitor sent to sign in on the way to a page lands on it. sync_user_attributesacceptsexternal_id; per providerlink_by_emailandprovision_on_deny.
Changed
- A refused SSO identity is not written. Roles are decided before the local user is created or updated; where the role mapping needs the user, the write runs in a transaction that is rolled back on a refusal.
provision_on_deny => truerestores the old order. remember => truecannot be combined withmax_session_minutesorrevalidate_every_minuteson a provider: it throws, naming the keys.- A config value that is set but unusable throws naming its key:
identity_match_attribute,identity_external_id_column,logout_url, the session limits, the challenge and password-login blocks,toast.durations. - A failure after the user step of an SSO callback (a throwing hook, a unique index) is a refusal on the login page with
SsoFailed, not a 500.
Fixed
identity_match_attribute = external_idnever stored the id, so the second sign-in of an auto-created user was refused. The id column is written on create, an existing row can be linked by email whenlink_by_emailis on, and a row holding a different id is never re-linked.- A refused SSO sign-in showed nothing on the login page. The callback flashed its message but the SPA never read it, so the visitor was sent back to the login page in silence. The shell publishes it once as
window.MartisConfig.flash.ssoand the login page shows it as an error toast. php artisan martis:sso azuredid not insert its block into a freshly published config: the commented example counted as "already declared".