Skip to content

Commit b005ff6

Browse files
feat(NODE-3445): add support for AssumeRoleWithWebIdentity in aws authentication (#3556)
1 parent 908b3b6 commit b005ff6

File tree

4 files changed

+1655
-1205
lines changed

4 files changed

+1655
-1205
lines changed

.evergreen/config.in.yml

+55-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,12 @@ functions:
545545
"iam_auth_assume_role_name" : "${iam_auth_assume_role_name}",
546546
"iam_auth_ec2_instance_account" : "${iam_auth_ec2_instance_account}",
547547
"iam_auth_ec2_instance_secret_access_key" : "${iam_auth_ec2_instance_secret_access_key}",
548-
"iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}"
548+
"iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}",
549+
"iam_auth_assume_web_role_name": "${iam_auth_assume_web_role_name}",
550+
"iam_web_identity_issuer": "${iam_web_identity_issuer}",
551+
"iam_web_identity_rsa_key": "${iam_web_identity_rsa_key}",
552+
"iam_web_identity_jwks_uri": "${iam_web_identity_jwks_uri}",
553+
"iam_web_identity_token_file": "${iam_web_identity_token_file}"
549554
}
550555
EOF
551556
@@ -697,6 +702,55 @@ functions:
697702
${PREPARE_SHELL}
698703
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
699704
705+
"run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME set":
706+
- command: shell.exec
707+
type: test
708+
params:
709+
working_dir: "src"
710+
silent: true
711+
script: |
712+
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
713+
. ./activate_venv.sh
714+
${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js
715+
cd -
716+
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
717+
export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file}
718+
export AWS_ROLE_ARN=${iam_auth_assume_web_role_name}
719+
export AWS_ROLE_SESSION_NAME='test'
720+
export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
721+
EOF
722+
- command: shell.exec
723+
type: test
724+
params:
725+
working_dir: "src"
726+
script: |
727+
${PREPARE_SHELL}
728+
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
729+
730+
"run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME unset":
731+
- command: shell.exec
732+
type: test
733+
params:
734+
working_dir: "src"
735+
silent: true
736+
script: |
737+
cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
738+
. ./activate_venv.sh
739+
${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js
740+
cd -
741+
cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
742+
export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file}
743+
export AWS_ROLE_ARN=${iam_auth_assume_web_role_name}
744+
export MONGODB_URI="mongodb://localhost:27017/aws?authMechanism=MONGODB-AWS"
745+
EOF
746+
- command: shell.exec
747+
type: test
748+
params:
749+
working_dir: "src"
750+
script: |
751+
${PREPARE_SHELL}
752+
${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh
753+
700754
"run aws ECS auth test":
701755
- command: shell.exec
702756
type: test

0 commit comments

Comments
 (0)