MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _authenticate_default

Function _authenticate_default

pymongo/asynchronous/auth.py:346–362  ·  view source on GitHub ↗
(credentials: MongoCredential, conn: AsyncConnection)

Source from the content-addressed store, hash-verified

344
345
346async 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]]] = {

Callers

nothing calls this directly

Calls 4

_authenticate_scramFunction · 0.70
hello_cmdMethod · 0.45
getMethod · 0.45
commandMethod · 0.45

Tested by

no test coverage detected