-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCSP-39405: kotlin v5.1 content (#161)
* DOCSP-39405: kotlin v5.1 content * NR small fixes * RL tech review comments (cherry picked from commit efd48c9)
- Loading branch information
Showing
12 changed files
with
292 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
kotlin.code.style=official | ||
kotlin_mongodb_version=4.11.0 | ||
kotlin_mongodb_version=5.1.0 |
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
5 changes: 5 additions & 0 deletions
5
source/examples/generated/EnterpriseAuthTest.snippet.oidc-azure-connection-string.kt
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,5 @@ | ||
val connectionString = ConnectionString( | ||
"mongodb://<username>@<hostname>:<port>/?" + | ||
"?authMechanism=MONGODB-OIDC" + | ||
"&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:<percent-encoded audience>") | ||
val mongoClient = MongoClient.create(connectionString) |
11 changes: 11 additions & 0 deletions
11
source/examples/generated/EnterpriseAuthTest.snippet.oidc-azure-credential.kt
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,11 @@ | ||
val credential = MongoCredential.createOidcCredential("<username>") | ||
.withMechanismProperty("ENVIRONMENT", "azure") | ||
.withMechanismProperty("TOKEN_RESOURCE", "<audience>") | ||
|
||
val mongoClient = MongoClient.create( | ||
MongoClientSettings.builder() | ||
.applyToClusterSettings { builder -> | ||
builder.hosts(listOf(ServerAddress("<hostname>", <port>))) | ||
} | ||
.credential(credential) | ||
.build()) |
14 changes: 14 additions & 0 deletions
14
source/examples/generated/EnterpriseAuthTest.snippet.oidc-callback-file.kt
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,14 @@ | ||
val credential = MongoCredential.createOidcCredential(null) | ||
.withMechanismProperty("OIDC_CALLBACK") { context: Context -> | ||
val accessToken = String(Files.readAllBytes(Paths.get("access-token.dat"))) | ||
OidcCallbackResult(accessToken) | ||
} | ||
|
||
val mongoClient = MongoClient.create( | ||
MongoClientSettings.builder() | ||
.applyToClusterSettings { builder -> | ||
builder.hosts(listOf(ServerAddress("<hostname>", <port>))) | ||
} | ||
.credential(credential) | ||
.build() | ||
) |
5 changes: 5 additions & 0 deletions
5
source/examples/generated/EnterpriseAuthTest.snippet.oidc-callback.kt
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,5 @@ | ||
val credential = MongoCredential.createOidcCredential(null) | ||
.withMechanismProperty("OIDC_CALLBACK") { context: Context -> | ||
val accessToken = "..." | ||
OidcCallbackResult(accessToken) | ||
} |
5 changes: 5 additions & 0 deletions
5
source/examples/generated/EnterpriseAuthTest.snippet.oidc-gcp-connection-string.kt
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,5 @@ | ||
val connectionString = ConnectionString( | ||
"mongodb://<hostname>:<port>/?" + | ||
"authMechanism=MONGODB-OIDC" + | ||
"&authMechanismProperties=ENVIRONMENT:gcp,TOKEN_RESOURCE:<percent-encoded audience>") | ||
val mongoClient = MongoClient.create(connectionString) |
11 changes: 11 additions & 0 deletions
11
source/examples/generated/EnterpriseAuthTest.snippet.oidc-gcp-credential.kt
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,11 @@ | ||
val credential = MongoCredential.createOidcCredential("<username>") | ||
.withMechanismProperty("ENVIRONMENT", "gcp") | ||
.withMechanismProperty("TOKEN_RESOURCE", "<audience>") | ||
|
||
val mongoClient = MongoClient.create( | ||
MongoClientSettings.builder() | ||
.applyToClusterSettings { builder -> | ||
builder.hosts(listOf(ServerAddress("<hostname>", <port>))) | ||
} | ||
.credential(credential) | ||
.build()) |
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