diff --git a/integration/run.py b/integration/run.py index 113df88..48cd315 100644 --- a/integration/run.py +++ b/integration/run.py @@ -72,9 +72,11 @@ async def get_user(self, username): password = user.get("password") return User( name=username, - auth_string=NativePasswordAuthPlugin.create_auth_string(password) - if password - else None, + auth_string=( + NativePasswordAuthPlugin.create_auth_string(password) + if password + else None + ), auth_plugin=NativePasswordAuthPlugin.name, ) elif auth_plugin == "authentication_kerberos": diff --git a/mysql_mimic/__init__.py b/mysql_mimic/__init__.py index 2da223c..9fec965 100644 --- a/mysql_mimic/__init__.py +++ b/mysql_mimic/__init__.py @@ -1,4 +1,5 @@ """Implementation of the mysql server wire protocol""" + from mysql_mimic.auth import ( User, IdentityProvider, diff --git a/mysql_mimic/auth.py b/mysql_mimic/auth.py index a6e07fd..0f7c8f7 100644 --- a/mysql_mimic/auth.py +++ b/mysql_mimic/auth.py @@ -219,6 +219,20 @@ async def auth(self, auth_info: Optional[AuthInfo] = None) -> AuthState: yield Success(username) +class GSSAPIAuthPlugin(KerberosAuthPlugin): + """ + This plugin implements the Generic Security Service Application Program + Interface (GSS-API) by way of the Kerberos mechanism as described in + RFC1964(https://www.rfc-editor.org/rfc/rfc1964.html). + + It uses the name of the GSSAPI plugin that the MariaDB client uses, but is + otherwise identical to KerberosAuthPlugin. + """ + + name = "auth_gssapi" + client_plugin_name = "auth_gssapi_client" + + class NoLoginAuthPlugin(AuthPlugin): """ Standard plugin that prevents all clients from direct login. diff --git a/mysql_mimic/connection.py b/mysql_mimic/connection.py index 10e7847..5160192 100644 --- a/mysql_mimic/connection.py +++ b/mysql_mimic/connection.py @@ -544,9 +544,11 @@ async def handle_stmt_fetch(self, data: bytes) -> None: await self.stream.write( self.ok_or_eof( - flags=types.ServerStatus.SERVER_STATUS_LAST_ROW_SENT - if done - else types.ServerStatus.SERVER_STATUS_CURSOR_EXISTS + flags=( + types.ServerStatus.SERVER_STATUS_LAST_ROW_SENT + if done + else types.ServerStatus.SERVER_STATUS_CURSOR_EXISTS + ) ) ) diff --git a/mysql_mimic/schema.py b/mysql_mimic/schema.py index bc3e0ab..5d7f587 100644 --- a/mysql_mimic/schema.py +++ b/mysql_mimic/schema.py @@ -275,8 +275,7 @@ class BaseInfoSchema: Base InfoSchema interface used by the `Session` class. """ - async def query(self, expression: exp.Expression) -> AllowedResult: - ... + async def query(self, expression: exp.Expression) -> AllowedResult: ... class InfoSchema(BaseInfoSchema): diff --git a/mysql_mimic/variables.py b/mysql_mimic/variables.py index 2c6fab6..a408462 100644 --- a/mysql_mimic/variables.py +++ b/mysql_mimic/variables.py @@ -10,8 +10,8 @@ from mysql_mimic.errors import MysqlError, ErrorCode -class Default: - ... +# pylint: disable=multiple-statements +class Default: ... VariableType = Callable[[Any], Any] @@ -102,8 +102,7 @@ def list(self) -> list[tuple[str, str]]: @property @abc.abstractmethod - def schema(self) -> dict[str, VariableSchema]: - ... + def schema(self) -> dict[str, VariableSchema]: ... class GlobalVariables(Variables): diff --git a/setup.py b/setup.py index 02c053c..16c0a20 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ "pytest", "pytest-asyncio", "sphinx", - "sqlalchemy", + "sqlalchemy[asyncio]", "twine", "wheel", ],