mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-02 02:58:10 +02:00
Add support for Cassandra auth with SSL check (#318)
Following recommended approach in Datastax documenation I've added the necessary TLS/SSL check https://docs.datastax.com/en/developer/python-driver/3.17/security/index.html
This commit is contained in:
parent
322725be04
commit
fe422b2b95
3 changed files with 10 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ from .. exceptions import RequestError
|
|||
from cassandra.cluster import Cluster
|
||||
from cassandra.auth import PlainTextAuthProvider
|
||||
from cassandra.query import BatchStatement
|
||||
from ssl import SSLContext, PROTOCOL_TLSv1_2
|
||||
import uuid
|
||||
import time
|
||||
|
||||
|
|
@ -21,12 +22,14 @@ class TableStore:
|
|||
print("Connecting to Cassandra...", flush=True)
|
||||
|
||||
if cassandra_user and cassandra_password:
|
||||
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
|
||||
auth_provider = PlainTextAuthProvider(
|
||||
username=cassandra_user, password=cassandra_password
|
||||
)
|
||||
self.cluster = Cluster(
|
||||
cassandra_host,
|
||||
auth_provider=auth_provider
|
||||
auth_provider=auth_provider,
|
||||
ssl_context=ssl_context
|
||||
)
|
||||
else:
|
||||
self.cluster = Cluster(cassandra_host)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue