Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion vertica_python/vertica/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def __init__(self, options=None):
self.options.setdefault('session_label', _generate_session_label())
self.options.setdefault('backup_server_node', DEFAULT_BACKUP_SERVER_NODE)
self.options.setdefault('workload', DEFAULT_WORKLOAD)
self.kerberos_is_set = self.options.get('kerberos_host_name', None) or self.options.get('kerberos_service_name', None)
self.options.setdefault('kerberos_service_name', DEFAULT_KRB_SERVICE_NAME)
# Kerberos authentication hostname defaults to the host value here so
# the correct value cannot be overwritten by load balancing or failover
Expand Down Expand Up @@ -830,9 +831,17 @@ def startup_connection(self):
request_complex_types = self.options['request_complex_types']
oauth_access_token = self.options['oauth_access_token']
workload = self.options['workload']
if len(oauth_access_token) > 0:
auth_category = 'OAuth'
elif self.kerberos_is_set:
auth_category = 'Kerberos'
elif password:
auth_category = 'User'
else:
auth_category = ''

self.write(messages.Startup(user, database, session_label, os_user_name, autocommit, binary_transfer,
request_complex_types, oauth_access_token, workload))
request_complex_types, oauth_access_token, workload, auth_category))

while True:
message = self.read_message()
Expand Down
7 changes: 4 additions & 3 deletions vertica_python/vertica/messages/frontend_messages/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
workload, auth_category):
BulkFrontendMessage.__init__(self)

try:
Expand Down Expand Up @@ -97,11 +97,12 @@ def __init__(self, user, database, session_label, os_user_name, autocommit,
b'protocol_features': '{"request_complex_types":' + request_complex_types + '}',
b'protocol_compat': 'VER',
b'workload': workload,
b'auth_category': auth_category,
}

if len(oauth_access_token) > 0:
self.parameters[b'oauth_access_token'] = oauth_access_token # protocol version 3.11
self.parameters[b'auth_category'] = 'OAuth' # protocol version 3.12+
# compatibility for protocol version 3.11
self.parameters[b'oauth_access_token'] = oauth_access_token

def read_bytes(self):
# The fixed protocol version is followed by pairs of parameter name and value strings.
Expand Down