authForTenant method

TenantAwareAuth authForTenant(
  1. String tenantId
)

Returns a TenantAwareAuth instance bound to the given tenant ID.

tenantId - The tenant ID whose TenantAwareAuth instance is to be returned.

Returns the TenantAwareAuth instance corresponding to this tenant identifier.

Implementation

TenantAwareAuth authForTenant(String tenantId) {
  if (tenantId.isEmpty) {
    throw FirebaseAuthAdminException(
      AuthClientErrorCode.invalidTenantId,
      'Tenant ID must be a non-empty string.',
    );
  }

  return _tenantsMap.putIfAbsent(
    tenantId,
    () => TenantAwareAuth._(_app, tenantId),
  );
}