From 6d00f928a37f538b6f5577f4badbe51ff4fbdfe9 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Mon, 31 Oct 2022 12:50:44 -0500 Subject: SERVER-70700 Use UserRequest to in authorization workflow --- src/mongo/db/session/SConscript | 1 + src/mongo/db/session/kill_sessions.cpp | 8 ++------ src/mongo/db/session/logical_session_id_test.cpp | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/mongo/db/session') 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); } }; -- cgit v1.2.1