forked from mongodb/mongo-go-driver
-
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.
GODRIVER-1395 add MONGODB-AWS auth mechanism (mongodb#334)
- Loading branch information
iwysiu
authored
Mar 17, 2020
1 parent
32aba96
commit a794f53
Showing
192 changed files
with
40,470 additions
and
323 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
############################################ | ||
# Main Program # | ||
############################################ | ||
|
||
if [[ -z "$1" ]]; then | ||
echo "usage: $0 <MONGODB_URI>" | ||
exit 1 | ||
fi | ||
export MONGODB_URI="$1" | ||
|
||
echo "Running MONGODB-AWS ECS authentication tests" | ||
|
||
if echo "$MONGODB_URI" | grep -q "@"; then | ||
echo "MONGODB_URI unexpectedly contains user credentials in ECS test!"; | ||
exit 1 | ||
fi | ||
|
||
./src/main |
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,34 @@ | ||
#!/bin/bash | ||
|
||
set -o xtrace | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
|
||
############################################ | ||
# Main Program # | ||
############################################ | ||
|
||
# Supported/used environment variables: | ||
# MONGODB_URI Set the URI, including an optional username/password to use | ||
# to connect to the server via MONGODB-AWS authentication | ||
# mechanism. | ||
|
||
echo "Running MONGODB-AWS authentication tests" | ||
# ensure no secrets are printed in log files | ||
set +x | ||
|
||
# load the script | ||
shopt -s expand_aliases # needed for `urlencode` alias | ||
[ -s "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" ] && source "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" | ||
|
||
MONGODB_URI=${MONGODB_URI:-"mongodb://localhost"} | ||
MONGODB_URI="${MONGODB_URI}/aws?authMechanism=MONGODB-AWS" | ||
if [[ -n ${SESSION_TOKEN} ]]; then | ||
MONGODB_URI="${MONGODB_URI}&authMechanismProperties=AWS_SESSION_TOKEN:${SESSION_TOKEN}" | ||
fi | ||
|
||
export MONGODB_URI="$MONGODB_URI" | ||
|
||
# show test output | ||
set -x | ||
|
||
go run "${PROJECT_DIRECTORY}/mongo/testaws/main.go" |
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
Oops, something went wrong.