-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement OIDC SASL mechanism (#1134)
* Implement OIDC SASL mechanism in sync (#1107) JAVA-4980 * Implement OIDC auth for async (#1131) JAVA-4981 * Remove non-machine workflow (#1259) JAVA-5077 * Add Human OIDC Workflow (#1316) JAVA-5328 * OIDC Add remaining environments (azure, gcp), evergreen testing, API naming updates (#1371) JAVA-5353 JAVA-5395 JAVA-4834 JAVA-4932 Co-authored-by: Valentin Kovalenko <valentin.kovalenko@mongodb.com>
- Loading branch information
Showing
37 changed files
with
3,825 additions
and
235 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,50 @@ | ||
#!/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: | ||
# DRIVERS_TOOLS The path to evergreeen tools | ||
# OIDC_AWS_* Required OIDC_AWS_* env variables must be configured | ||
# | ||
# Environment variables used as output: | ||
# OIDC_TESTS_ENABLED Allows running OIDC tests | ||
# OIDC_TOKEN_DIR The path to generated OIDC AWS tokens | ||
# AWS_WEB_IDENTITY_TOKEN_FILE The path to AWS token for device workflow | ||
|
||
if [ -z ${DRIVERS_TOOLS+x} ]; then | ||
echo "DRIVERS_TOOLS. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ROLE_ARN+x} ]; then | ||
echo "OIDC_AWS_ROLE_ARN. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_SECRET_ACCESS_KEY+x} ]; then | ||
echo "OIDC_AWS_SECRET_ACCESS_KEY. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ACCESS_KEY_ID+x} ]; then | ||
echo "OIDC_AWS_ACCESS_KEY_ID. is not set"; | ||
exit 1 | ||
fi | ||
|
||
export AWS_ROLE_ARN=${OIDC_AWS_ROLE_ARN} | ||
export AWS_SECRET_ACCESS_KEY=${OIDC_AWS_SECRET_ACCESS_KEY} | ||
export AWS_ACCESS_KEY_ID=${OIDC_AWS_ACCESS_KEY_ID} | ||
export OIDC_FOLDER=${DRIVERS_TOOLS}/.evergreen/auth_oidc | ||
export OIDC_TOKEN_DIR=${OIDC_FOLDER}/test_tokens | ||
export AWS_WEB_IDENTITY_TOKEN_FILE=${OIDC_TOKEN_DIR}/test1 | ||
export OIDC_TESTS_ENABLED=true | ||
|
||
echo "Configuring OIDC server for local authentication tests" | ||
|
||
cd ${OIDC_FOLDER} | ||
DRIVERS_TOOLS=${DRIVERS_TOOLS} ./oidc_get_tokens.sh |
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,50 @@ | ||
#!/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: | ||
# DRIVERS_TOOLS The path to evergreeen tools | ||
# OIDC_AWS_* OIDC_AWS_* env variables must be configured | ||
# | ||
# Environment variables used as output: | ||
# OIDC_TESTS_ENABLED Allows running OIDC tests | ||
# OIDC_TOKEN_DIR The path to generated tokens | ||
# AWS_WEB_IDENTITY_TOKEN_FILE The path to AWS token for device workflow | ||
|
||
if [ -z ${DRIVERS_TOOLS+x} ]; then | ||
echo "DRIVERS_TOOLS. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ROLE_ARN+x} ]; then | ||
echo "OIDC_AWS_ROLE_ARN. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_SECRET_ACCESS_KEY+x} ]; then | ||
echo "OIDC_AWS_SECRET_ACCESS_KEY. is not set"; | ||
exit 1 | ||
fi | ||
|
||
if [ -z ${OIDC_AWS_ACCESS_KEY_ID+x} ]; then | ||
echo "OIDC_AWS_ACCESS_KEY_ID. is not set"; | ||
exit 1 | ||
fi | ||
|
||
export AWS_ROLE_ARN=${OIDC_AWS_ROLE_ARN} | ||
export AWS_SECRET_ACCESS_KEY=${OIDC_AWS_SECRET_ACCESS_KEY} | ||
export AWS_ACCESS_KEY_ID=${OIDC_AWS_ACCESS_KEY_ID} | ||
export OIDC_FOLDER=${DRIVERS_TOOLS}/.evergreen/auth_oidc | ||
export OIDC_TOKEN_DIR=${OIDC_FOLDER}/test_tokens | ||
export AWS_WEB_IDENTITY_TOKEN_FILE=${OIDC_TOKEN_DIR}/test1 | ||
export OIDC_TESTS_ENABLED=true | ||
|
||
echo "Configuring OIDC server for local authentication tests" | ||
|
||
cd ${OIDC_FOLDER} | ||
DRIVERS_TOOLS=${DRIVERS_TOOLS} ./start_local_server.sh |
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,40 @@ | ||
#!/bin/bash | ||
|
||
set +x # Disable debug trace | ||
set -eu | ||
|
||
echo "Running MONGODB-OIDC authentication tests" | ||
echo "OIDC_ENV $OIDC_ENV" | ||
|
||
if [ $OIDC_ENV == "test" ]; then | ||
if [ -z "$DRIVERS_TOOLS" ]; then | ||
echo "Must specify DRIVERS_TOOLS" | ||
exit 1 | ||
fi | ||
source ${DRIVERS_TOOLS}/.evergreen/auth_oidc/secrets-export.sh | ||
# java will not need to be installed, but we need to config | ||
RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")" | ||
source "${RELATIVE_DIR_PATH}/javaConfig.bash" | ||
elif [ $OIDC_ENV == "azure" ]; then | ||
source ./env.sh | ||
elif [ $OIDC_ENV == "gcp" ]; then | ||
source ./secrets-export.sh | ||
else | ||
echo "Unrecognized OIDC_ENV $OIDC_ENV" | ||
exit 1 | ||
fi | ||
|
||
|
||
if ! which java ; then | ||
echo "Installing java..." | ||
sudo apt install openjdk-17-jdk -y | ||
echo "Installed java." | ||
fi | ||
|
||
which java | ||
export OIDC_TESTS_ENABLED=true | ||
|
||
./gradlew -Dorg.mongodb.test.uri="$MONGODB_URI" \ | ||
--stacktrace --debug --info --no-build-cache driver-core:cleanTest \ | ||
driver-sync:test --tests OidcAuthenticationProseTests --tests UnifiedAuthTest \ | ||
driver-reactive-streams:test --tests OidcAuthenticationAsyncProseTests \ |
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.