diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2019-12-02 15:20:45 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-02 15:20:45 +0000 |
commit | 6e87fdd5d291e3d363a8ee5a22ddc5cbd87f150e (patch) | |
tree | 3f031f88c737563aed38e3eed9c32debc09429e5 /src/mongo/client/sasl_client_authenticate_impl.cpp | |
parent | 7861a2618676421aa4ad79f9a831c048b72b0043 (diff) | |
download | mongo-6e87fdd5d291e3d363a8ee5a22ddc5cbd87f150e.tar.gz |
SERVER-44264 Add IAM client code to shell and clients
Diffstat (limited to 'src/mongo/client/sasl_client_authenticate_impl.cpp')
-rw-r--r-- | src/mongo/client/sasl_client_authenticate_impl.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/client/sasl_client_authenticate_impl.cpp b/src/mongo/client/sasl_client_authenticate_impl.cpp index 4d19e5597d2..8a5794f95e0 100644 --- a/src/mongo/client/sasl_client_authenticate_impl.cpp +++ b/src/mongo/client/sasl_client_authenticate_impl.cpp @@ -144,9 +144,11 @@ Status configureSession(SaslClientSession* session, session->setParameter(SaslClientSession::parameterServiceHostAndPort, hostname.toString()); status = bsonExtractStringField(saslParameters, saslCommandUserFieldName, &value); - if (!status.isOK()) + if (status.isOK()) { + session->setParameter(SaslClientSession::parameterUser, value); + } else if ((targetDatabase != "$external") || (mechanism != "MONGODB-IAM")) { return status; - session->setParameter(SaslClientSession::parameterUser, value); + } const bool digestPasswordDefault = (mechanism == "SCRAM-SHA-1"); bool digestPassword; @@ -163,6 +165,11 @@ Status configureSession(SaslClientSession* session, return status; } + status = bsonExtractStringField(saslParameters, saslCommandIamSessionToken, &value); + if (status.isOK()) { + session->setParameter(SaslClientSession::parameterIamSessionToken, value); + } + return session->initialize(); } |