diff --git a/Snowflake.Data/Core/Session/ConnectionPoolManager.cs b/Snowflake.Data/Core/Session/ConnectionPoolManager.cs index af138ff56..ea1b8ba3b 100644 --- a/Snowflake.Data/Core/Session/ConnectionPoolManager.cs +++ b/Snowflake.Data/Core/Session/ConnectionPoolManager.cs @@ -140,13 +140,6 @@ public SessionPool GetPool(string connectionString, SecureString password) public SessionPool GetPool(string connectionString) { s_logger.Debug($"ConnectionPoolManager::GetPool"); - // unless it is an external browser then those two must be passed along - var connStr = $";{connectionString.ToLower()};"; - if (!connStr.Contains(";password=") && connStr.Contains(";user=")) - { - s_logger.Error($"To obtain a pool a password must to be given with a connection string or SecureString parameter"); - throw new SnowflakeDbException(SFError.MISSING_CONNECTION_PROPERTY, "Could not provide the pool without the password"); - } return GetPool(connectionString, null); } diff --git a/Snowflake.Data/Core/Session/SessionPool.cs b/Snowflake.Data/Core/Session/SessionPool.cs index a79860774..a8697b355 100644 --- a/Snowflake.Data/Core/Session/SessionPool.cs +++ b/Snowflake.Data/Core/Session/SessionPool.cs @@ -109,6 +109,7 @@ private static Tuple ExtractConfig(string connecti { var properties = SFSessionProperties.ParseConnectionString(connectionString, password); var extractedProperties = SFSessionHttpClientProperties.ExtractAndValidate(properties); + ValidatePasswordProvided(properties); return Tuple.Create(extractedProperties.BuildConnectionPoolConfig(), properties.ConnectionStringWithoutSecrets); } catch (Exception exception) @@ -118,6 +119,16 @@ private static Tuple ExtractConfig(string connecti } } + private static void ValidatePasswordProvided(SFSessionProperties properties) + { + var isPasswordGiven = !string.IsNullOrEmpty(properties[SFSessionProperty.PASSWORD]); + if (!isPasswordGiven) + { + s_logger.Error($"To obtain a pool a password must to be given with a connection string or SecureString parameter"); + throw new SnowflakeDbException(SFError.MISSING_CONNECTION_PROPERTY, "Could not provide the pool without the password"); + } + } + internal SFSession GetSession(string connStr, SecureString password) { s_logger.Debug("SessionPool::GetSession" + PoolIdentification());