(credentials: MongoCredential, conn: AsyncConnection)
| 344 | |
| 345 | |
| 346 | async def _authenticate_default(credentials: MongoCredential, conn: AsyncConnection) -> None: |
| 347 | if conn.max_wire_version >= 7: |
| 348 | if conn.negotiated_mechs: |
| 349 | mechs = conn.negotiated_mechs |
| 350 | else: |
| 351 | source = credentials.source |
| 352 | cmd = conn.hello_cmd() |
| 353 | cmd["saslSupportedMechs"] = source + "." + credentials.username |
| 354 | mechs = (await conn.command(source, cmd, publish_events=False)).get( |
| 355 | "saslSupportedMechs", [] |
| 356 | ) |
| 357 | if "SCRAM-SHA-256" in mechs: |
| 358 | return await _authenticate_scram(credentials, conn, "SCRAM-SHA-256") |
| 359 | else: |
| 360 | return await _authenticate_scram(credentials, conn, "SCRAM-SHA-1") |
| 361 | else: |
| 362 | return await _authenticate_scram(credentials, conn, "SCRAM-SHA-1") |
| 363 | |
| 364 | |
| 365 | _AUTH_MAP: Mapping[str, Callable[..., Coroutine[Any, Any, None]]] = { |
nothing calls this directly
no test coverage detected