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