Skip to content

Commit e47d0df

Browse files
committed
Fix typing issues
Change-Id: I9605d51bc3560384db5d9cf0483bff5716e6ae90
1 parent 5b38aa8 commit e47d0df

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/mysql/connector/plugins/authentication_kerberos_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def get_store() -> dict:
202202
"""
203203
krb5ccname = os.environ.get(
204204
"KRB5CCNAME",
205-
f"/tmp/krb5cc_{os.getuid()}" # type: ignore[attr-defined]
205+
f"/tmp/krb5cc_{os.getuid()}"
206206
if os.name == "posix"
207207
else Path("%TEMP%").joinpath("krb5cc"),
208208
)

lib/mysql/connector/plugins/authentication_webauthn_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def requires_ssl(self) -> bool:
9797

9898
def get_assertion_response(
9999
self, credential_id: Optional[bytearray] = None
100-
) -> bytearray:
100+
) -> bytes:
101101
"""Get assertion from authenticator and return the response.
102102
103103
Args:
@@ -165,7 +165,7 @@ def get_assertion_response(
165165
logger.debug("WebAuthn - payload response packet: %s", packet)
166166
return packet
167167

168-
def auth_response(self, auth_data: bytes, **kwargs: Any) -> int:
168+
def auth_response(self, auth_data: bytes, **kwargs: Any) -> Optional[bytes]:
169169
"""Find authenticator device and check if supports resident keys.
170170
171171
It also creates a Fido2Client using the relying party ID from the server.
@@ -194,7 +194,7 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> int:
194194
if device is not None:
195195
logger.debug("WebAuthn - Use USB HID channel")
196196
elif CTAP_PCSC_DEVICE_AVAILABLE:
197-
device = next(CtapPcscDevice.list_devices(), None) # type: ignore[arg-type]
197+
device = next(CtapPcscDevice.list_devices(), None)
198198

199199
if device is None:
200200
raise errors.InterfaceError("No FIDO device found")
@@ -208,10 +208,10 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> int:
208208

209209
if not self.client.info.options.get("rk"):
210210
logger.debug("WebAuthn - Authenticator doesn't support resident keys")
211-
return 1
211+
return b"1"
212212

213213
logger.debug("WebAuthn - Authenticator with support for resident key found")
214-
return 2
214+
return b"2"
215215

216216
def auth_more_response(
217217
self, sock: "MySQLSocket", auth_data: bytes, **kwargs: Any
@@ -271,10 +271,10 @@ def auth_switch_response(
271271
response = self.auth_response(auth_data)
272272
credential_id = None
273273

274-
if response == 1:
274+
if response == b"1":
275275
# Authenticator doesn't support resident keys, request credential_id
276276
logger.debug("WebAuthn - request credential_id")
277-
sock.send(utils.lc_int(response))
277+
sock.send(utils.lc_int(int(response)))
278278

279279
# return a packet representing an `auth more data` response
280280
return bytes(sock.recv())

0 commit comments

Comments
 (0)