From 5ad94a9ebec2bda79b7e7088971ed38bc8b3ecc7 Mon Sep 17 00:00:00 2001 From: sharmagot Date: Fri, 28 Nov 2025 06:18:39 -0500 Subject: [PATCH] Add TOTP support to Startup message for authentication --- .../vertica/messages/backend_messages/authentication.py | 1 + vertica_python/vertica/messages/frontend_messages/startup.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vertica_python/vertica/messages/backend_messages/authentication.py b/vertica_python/vertica/messages/backend_messages/authentication.py index 017c91b8..3f3f2885 100644 --- a/vertica_python/vertica/messages/backend_messages/authentication.py +++ b/vertica_python/vertica/messages/backend_messages/authentication.py @@ -57,6 +57,7 @@ class Authentication(BackendMessage): PASSWORD_CHANGED = 10 # client doesn't do password changing, this should never be seen PASSWORD_GRACE = 11 OAUTH = 12 + TOTP = 14 HASH = 65536 HASH_MD5 = 65536 + 5 HASH_SHA512 = 65536 + 512 diff --git a/vertica_python/vertica/messages/frontend_messages/startup.py b/vertica_python/vertica/messages/frontend_messages/startup.py index 28838f9d..970b48fc 100644 --- a/vertica_python/vertica/messages/frontend_messages/startup.py +++ b/vertica_python/vertica/messages/frontend_messages/startup.py @@ -59,7 +59,7 @@ class Startup(BulkFrontendMessage): def __init__(self, user, database, session_label, os_user_name, autocommit, binary_transfer, request_complex_types, oauth_access_token, - workload, auth_category): + workload, auth_category, totp=None): BulkFrontendMessage.__init__(self) try: @@ -103,7 +103,8 @@ def __init__(self, user, database, session_label, os_user_name, autocommit, if len(oauth_access_token) > 0: # compatibility for protocol version 3.11 self.parameters[b'oauth_access_token'] = oauth_access_token - + if totp is not None: + self.parameters[b'totp'] = totp def read_bytes(self): # The fixed protocol version is followed by pairs of parameter name and value strings. # A zero byte is required as a terminator after the last name/value pair.