diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2022-10-31 12:50:44 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-12-24 00:17:55 +0000 |
commit | 6d00f928a37f538b6f5577f4badbe51ff4fbdfe9 (patch) | |
tree | f4b23f40c9eae5563049be178c8d3e71a292d328 /src/mongo/db/session | |
parent | 50a078398644853cd135d734554425a95d7256cf (diff) | |
download | mongo-6d00f928a37f538b6f5577f4badbe51ff4fbdfe9.tar.gz |
SERVER-70700 Use UserRequest to in authorization workflow
Diffstat (limited to 'src/mongo/db/session')
-rw-r--r-- | src/mongo/db/session/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/session/kill_sessions.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/session/logical_session_id_test.cpp | 4 |
3 files changed, 5 insertions, 8 deletions
diff --git a/src/mongo/db/session/SConscript b/src/mongo/db/session/SConscript index 9862c8a660b..a0021e3ac81 100644 --- a/src/mongo/db/session/SConscript +++ b/src/mongo/db/session/SConscript @@ -155,6 +155,7 @@ env.Library( '$BUILD_DIR/mongo/db/api_parameters', '$BUILD_DIR/mongo/db/auth/auth', '$BUILD_DIR/mongo/db/auth/authprivilege', + '$BUILD_DIR/mongo/db/auth/user', '$BUILD_DIR/mongo/idl/idl_parser', '$BUILD_DIR/mongo/rpc/client_metadata', 'logical_session_id_helpers', diff --git a/src/mongo/db/session/kill_sessions.cpp b/src/mongo/db/session/kill_sessions.cpp index 7626afa111b..99d8fd5122a 100644 --- a/src/mongo/db/session/kill_sessions.cpp +++ b/src/mongo/db/session/kill_sessions.cpp @@ -109,12 +109,8 @@ KillAllSessionsByPatternItem makeKillAllSessionsByPattern(OperationContext* opCt const KillAllSessionsUser& kasu) { KillAllSessionsByPatternItem item = makeKillAllSessionsByPattern(opCtx); - auto authMgr = AuthorizationManager::get(opCtx->getServiceContext()); - - UserName un(kasu.getUser(), kasu.getDb()); - - auto user = uassertStatusOK(authMgr->acquireUser(opCtx, un)); - item.pattern.setUid(user->getDigest()); + User user(UserRequest(UserName(kasu.getUser(), kasu.getDb()), boost::none)); + item.pattern.setUid(user.getDigest()); return item; } diff --git a/src/mongo/db/session/logical_session_id_test.cpp b/src/mongo/db/session/logical_session_id_test.cpp index 5b5f59fbb83..a338ca5ddae 100644 --- a/src/mongo/db/session/logical_session_id_test.cpp +++ b/src/mongo/db/session/logical_session_id_test.cpp @@ -111,7 +111,7 @@ public: << "db" << "test"))), BSONObj())); - ASSERT_OK(authzSession->addAndAuthorizeUser(_opCtx.get(), un, boost::none)); + ASSERT_OK(authzSession->addAndAuthorizeUser(_opCtx.get(), {un, boost::none}, boost::none)); return authzSession->lookupUser(un); } @@ -126,7 +126,7 @@ public: << "db" << "admin"))), BSONObj())); - ASSERT_OK(authzSession->addAndAuthorizeUser(_opCtx.get(), un, boost::none)); + ASSERT_OK(authzSession->addAndAuthorizeUser(_opCtx.get(), {un, boost::none}, boost::none)); return authzSession->lookupUser(un); } }; |