forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚨 Add ability to enforce SSL in MongoDB source connector (airbytehq#1…
…7590) * Check and test for if we are disabling SSL/TLS in source-mongodb-strict-encrypt * Update docs * Address comments * auto-bump connector version [ci skip] Co-authored-by: Octavia Squidington III <[email protected]>
- Loading branch information
1 parent
ada1cbf
commit 4b990d0
Showing
9 changed files
with
126 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...e-mongodb-v2/src/main/java/io.airbyte.integrations.source.mongodb/MongoDbSourceUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.airbyte.integrations.source.mongodb; | ||
|
||
import static org.bson.BsonType.DATE_TIME; | ||
import static org.bson.BsonType.DECIMAL128; | ||
import static org.bson.BsonType.DOCUMENT; | ||
import static org.bson.BsonType.DOUBLE; | ||
import static org.bson.BsonType.INT32; | ||
import static org.bson.BsonType.INT64; | ||
import static org.bson.BsonType.OBJECT_ID; | ||
import static org.bson.BsonType.STRING; | ||
import static org.bson.BsonType.TIMESTAMP; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.airbyte.db.jdbc.JdbcUtils; | ||
import java.util.Set; | ||
import org.bson.BsonType; | ||
|
||
public final class MongoDbSourceUtils { | ||
|
||
private MongoDbSourceUtils() {} | ||
|
||
public static final String MONGODB_SERVER_URL = "mongodb://%s%s:%s/%s?authSource=%s&ssl=%s"; | ||
public static final String MONGODB_CLUSTER_URL = "mongodb+srv://%s%s/%s?authSource=%s&retryWrites=true&w=majority&tls=true"; | ||
public static final String MONGODB_REPLICA_URL = "mongodb://%s%s/%s?authSource=%s&directConnection=false&ssl=true"; | ||
public static final String USER = "user"; | ||
public static final String INSTANCE_TYPE = "instance_type"; | ||
public static final String INSTANCE = "instance"; | ||
public static final String CLUSTER_URL = "cluster_url"; | ||
public static final String SERVER_ADDRESSES = "server_addresses"; | ||
public static final String REPLICA_SET = "replica_set"; | ||
public static final String AUTH_SOURCE = "auth_source"; | ||
public static final String PRIMARY_KEY = "_id"; | ||
public static final Set<BsonType> ALLOWED_CURSOR_TYPES = Set.of(DOUBLE, STRING, DOCUMENT, OBJECT_ID, DATE_TIME, | ||
INT32, TIMESTAMP, INT64, DECIMAL128); | ||
|
||
/** | ||
* Determines whether TLS/SSL should be enabled for a standalone instance of MongoDB. | ||
*/ | ||
public static boolean tlsEnabledForStandaloneInstance(final JsonNode config, final JsonNode instanceConfig) { | ||
return config.has(JdbcUtils.TLS_KEY) ? config.get(JdbcUtils.TLS_KEY).asBoolean() | ||
: (instanceConfig.has(JdbcUtils.TLS_KEY) ? instanceConfig.get(JdbcUtils.TLS_KEY).asBoolean() : true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters