Skip to content

Commit 6962ad0

Browse files
committed
debug
1 parent 5a6c7b2 commit 6962ad0

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

pymongo/asynchronous/auth_oidc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ async def authenticate(self, conn: AsyncConnection) -> Optional[Mapping[str, Any
9999
# If it succeeded, we are done.
100100
ctx = conn.auth_ctx
101101
if ctx and ctx.speculate_succeeded():
102+
print("speculative auth succeeded")
102103
resp = ctx.speculative_authenticate
103104
if resp and resp["done"]:
104105
conn.oidc_token_gen_id = self.token_gen_id
105106
return resp
107+
elif ctx:
108+
print("speculative auth failed")
109+
else:
110+
print("no speculative auth")
106111

107112
# If spec auth failed, call the appropriate auth logic for the callback type.
108113
# We cannot assume that the token is invalid, because a proxy may have been

pymongo/asynchronous/helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ async def inner(*args: Any, **kwargs: Any) -> Any:
4545
return await func(*args, **kwargs)
4646
except OperationFailure as exc:
4747
if no_reauth:
48+
print("failure with no reauth")
4849
raise
4950
if exc.code == _REAUTHENTICATION_REQUIRED_CODE:
5051
# Look for an argument that either is a AsyncConnection
5152
# or has a connection attribute, so we can trigger
5253
# a reauth.
54+
print("got reauth")
5355
conn = None
5456
for arg in args:
5557
if isinstance(arg, AsyncConnection):
@@ -59,8 +61,10 @@ async def inner(*args: Any, **kwargs: Any) -> Any:
5961
conn = arg.conn # type: ignore[assignment]
6062
break
6163
if conn:
64+
print("running reauth")
6265
await conn.authenticate(reauthenticate=True)
6366
else:
67+
print("not running reauth, no conn")
6468
raise
6569
return func(*args, **kwargs)
6670
raise

pymongo/synchronous/auth_oidc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ def authenticate(self, conn: Connection) -> Optional[Mapping[str, Any]]:
9999
# If it succeeded, we are done.
100100
ctx = conn.auth_ctx
101101
if ctx and ctx.speculate_succeeded():
102+
print("speculative auth succeeded")
102103
resp = ctx.speculative_authenticate
103104
if resp and resp["done"]:
104105
conn.oidc_token_gen_id = self.token_gen_id
105106
return resp
107+
elif ctx:
108+
print("speculative auth failed")
109+
else:
110+
print("no speculative auth")
106111

107112
# If spec auth failed, call the appropriate auth logic for the callback type.
108113
# We cannot assume that the token is invalid, because a proxy may have been

pymongo/synchronous/helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ def inner(*args: Any, **kwargs: Any) -> Any:
4545
return func(*args, **kwargs)
4646
except OperationFailure as exc:
4747
if no_reauth:
48+
print("failure with no reauth")
4849
raise
4950
if exc.code == _REAUTHENTICATION_REQUIRED_CODE:
5051
# Look for an argument that either is a Connection
5152
# or has a connection attribute, so we can trigger
5253
# a reauth.
54+
print("got reauth")
5355
conn = None
5456
for arg in args:
5557
if isinstance(arg, Connection):
@@ -59,8 +61,10 @@ def inner(*args: Any, **kwargs: Any) -> Any:
5961
conn = arg.conn # type: ignore[assignment]
6062
break
6163
if conn:
64+
print("running reauth")
6265
conn.authenticate(reauthenticate=True)
6366
else:
67+
print("not running reauth, no conn")
6468
raise
6569
return func(*args, **kwargs)
6670
raise

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ ignore = [
193193
"EM103", # Exception must not use a `.format()` string directly, assign to variable first
194194
"C408", # Unnecessary `dict` call (rewrite as a literal)
195195
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
196+
"T20",
196197
]
197198
unfixable = [
198199
"RUF100", # Unused noqa

0 commit comments

Comments
 (0)