Skip to content

Commit cb2daea

Browse files
committed
Address review feedback: validate auth_type in _acquire_token, fix fallthrough return, clean up extract_auth_type parsing
1 parent 16e3a0c commit cb2daea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mssql_python/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ def extract_auth_type(connection_string: str) -> Optional[str]:
229229
AuthType.DEFAULT.value: "default",
230230
}
231231
for part in connection_string.split(";"):
232-
part = part.strip()
233-
if part.lower().startswith("authentication="):
234-
return auth_map.get(part.split("=", 1)[1].strip().lower())
232+
key, _, value = part.strip().partition("=")
233+
if key.strip().lower() == "authentication":
234+
return auth_map.get(value.strip().lower())
235235
return None
236236

237237

0 commit comments

Comments
 (0)