@kb-labs/gateway-app 2.105.0 → 2.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -517,7 +517,7 @@ async function recordLoginFailure(reply, ip, emailNorm, rateLimiter, cfg) {
517
517
  return true;
518
518
  }
519
519
  function registerUserAuthRoutes(app, deps) {
520
- const { userAuthService, users, sessions, invites, providers, pdp, tenantResolver, cookieOpts, inviteTtlMs, rateLimiter, authRateLimit, oauthState, oauthCallbackPerIpPerMinute } = deps;
520
+ const { userAuthService, users, sessions, invites, providers, pdp, tenantResolver, bootstrapTenantId, cookieOpts, inviteTtlMs, rateLimiter, authRateLimit, oauthState, oauthCallbackPerIpPerMinute } = deps;
521
521
  const authRateLimitCfg = { loginPerIpPerMinute: 10, loginPerEmailPerMinute: 5, ...authRateLimit };
522
522
  if (oauthState) {
523
523
  registerOAuthRoutes(app, {
@@ -569,7 +569,7 @@ function registerUserAuthRoutes(app, deps) {
569
569
  }
570
570
  const host = typeof request.headers.host === "string" ? request.headers.host : "";
571
571
  const hostTenant = tenantResolver.resolve(host);
572
- const tenantId = hostTenant ?? bodyTenantId ?? "";
572
+ const tenantId = hostTenant ?? bodyTenantId ?? bootstrapTenantId;
573
573
  if (rateLimiter) {
574
574
  const emailNorm = email.toLowerCase().trim();
575
575
  if (!await peekLoginRateLimit(reply, request.ip, emailNorm, rateLimiter, authRateLimitCfg)) {
@@ -615,7 +615,7 @@ function registerUserAuthRoutes(app, deps) {
615
615
  }
616
616
  const host = typeof request.headers.host === "string" ? request.headers.host : "";
617
617
  const hostTenant = tenantResolver.resolve(host);
618
- const tenantId = hostTenant ?? bodyTenantId ?? "";
618
+ const tenantId = hostTenant ?? bodyTenantId ?? bootstrapTenantId;
619
619
  if (rateLimiter) {
620
620
  const emailNorm = email.toLowerCase().trim();
621
621
  if (!await peekLoginRateLimit(reply, request.ip, emailNorm, rateLimiter, authRateLimitCfg)) {
@@ -3965,6 +3965,7 @@ async function createServer(config, cache, logger, jwtConfig, registry, serviceT
3965
3965
  providers: userAuth.providers,
3966
3966
  pdp: userAuth.pdp,
3967
3967
  tenantResolver: userAuth.tenantResolver,
3968
+ bootstrapTenantId: userAuth.bootstrapTenantId,
3968
3969
  cookieOpts: { cookieSecure: userAuth.cookieSecure },
3969
3970
  accessTtlSec: userAuth.accessTtlSec,
3970
3971
  refreshTtlSec: userAuth.refreshTtlSec,
@@ -4325,6 +4326,7 @@ async function bootstrap(repoRoot = process.cwd()) {
4325
4326
  providers,
4326
4327
  pdp,
4327
4328
  tenantResolver,
4329
+ bootstrapTenantId,
4328
4330
  cookieSecure,
4329
4331
  accessTtlSec,
4330
4332
  refreshTtlSec,