LibreChat/api/strategies
Danny Avila 8b58ebc4d5
🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779)
* 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins

SAML, LDAP and social logins looked the user up and then inserted it
with nothing in between, so two first logins for one new identity both
inserted and the unique index failed the second with E11000.

Every strategy now provisions first-login users in packages/api:
createUserOnce inserts through createUserIfAbsent and, on user_exists,
repeats the strategy's own lookup and resolves to the account that won,
once its creator finished provisioning it (its start balance exists when
one is configured), admitted exactly as a found account (a tenant
account resolves its tenant config and that config's email-domain policy
applies). provisionSamlUser, provisionLdapUser and provisionSocialUser
own the create / recover / refresh decision, so a recovered account gets
the same refresh as any account the login finds (claimSamlIdentity, the
LDAP directory overwrite, handleExistingUser), and the CJS strategies
only pass their models and services and map the result to passport.
The lookups take a plain FindUserByFields and the contracts carry
UserRecord and NewUserData. createOpenIDUser now goes through
createUserOnce.

Related to #16766

* ⚡ perf: Read a Recovered Account's Config and Balance Together

After losing the insert race, createUserOnce resolved the tenant config
and only then read the start balance, although the balance check now
depends only on the creation config. Both reads start together.
2026-10-05 17:57:23 -04:00
..
appleStrategy.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
appleStrategy.test.js 🔑 feat: Refresh-Capable Google Admin OAuth Sessions (#13832) 2026-08-07 00:10:34 -04:00
discordStrategy.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
facebookStrategy.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
githubStrategy.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
googleStrategy.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
index.js 🔐 feat: Admin Auth Support for SAML and Social OAuth Providers (#12472) 2026-03-30 22:49:44 -04:00
jwtStrategy.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
jwtStrategy.spec.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
ldapStrategy.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
ldapStrategy.spec.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
localStrategy.js 🔑 feat: Passkey Authentication with WebAuthn Sign-In and Management (#14715) 2026-10-01 03:46:16 +00:00
openIdJwtStrategy.js ⚡ perf: Async Local File Saves and Compile Hot-Path Regexes Once (#16712) 2026-10-04 15:52:55 -04:00
openIdJwtStrategy.spec.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
openidStrategy.js 🚪 fix: Let Concurrent First OpenID Logins Continue as the New User (#16778) 2026-10-05 17:56:57 -04:00
openidStrategy.spec.js 🚪 fix: Let Concurrent First OpenID Logins Continue as the New User (#16778) 2026-10-05 17:56:57 -04:00
process.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
process.test.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
samlStrategy.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
samlStrategy.spec.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
socialLogin.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
socialLogin.test.js 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
validators.js
validators.spec.js