chore: log in and out through SAML without Meteor's accounts runtime
Merged
GG
13h ago+53+53+01234567890123456789-72-72-01234567890123456789
Proposed changes
SAML login hung off the Meteor global (Meteor.loginWithSaml, Meteor.loginWithSamlToken), and single logout patched Meteor.logout. None of it existed in the Vite client: SAMLLoginRoute called an inert shim, and vite/native/login.ts skipped the module.
loginWithSamlregisters throughregisterLoginWithMethod, like CAS and LDAP.loginWithSamlTokenis exported, andSAMLLoginRouteimports it directly.- The identity-provider logout is
logoutFromSamlIdp().UserProvidercalls it before the local logout, and it returnsfalsewhen the session should only end locally. That is the same decision tree theMeteor.logoutoverride used. vite/native/login.tsnow loads the SAML module.- The type augmentations that only described the removed globals (
Meteor.loginWithSaml*,Accounts.saml) are gone.Accounts.onLogoutand theservice-configurationfields stay, because the server uses them.
Both builds now run the same SAML code.
Steps to test or reproduce
With a SAML IdP (e.g. Keycloak) configured:
- Log in through the SAML button. You land on
/homelogged in. With an invite token, you land on/invite/<token>. - With
SAML_Custom_Default_logout_behaviourset to SAML and an SLO redirect URL configured, logging out redirects through_saml/sloRedirect/.... - With the logout behaviour set to Local, logging out only ends the Rocket.Chat session.
- Repeat 1–3 on
yarn dev:next(Vite client).
Issue(s)
Summary by CodeRabbit
-
Bug Fixes
- Improved SAML logout handling, including fallback to local logout when identity-provider logout is unavailable or unsuccessful.
- Preserved SAML login behavior across browser and native login flows, including token handoff and navigation.
-
Tests
- Updated SAML login coverage to validate the current login flow and callback behavior.