diff --git a/src/mongo/db/auth/user_request_x509.cpp b/src/mongo/db/auth/user_request_x509.cpp index 57534d59418..14066222591 100644 --- a/src/mongo/db/auth/user_request_x509.cpp +++ b/src/mongo/db/auth/user_request_x509.cpp @@ -43,8 +43,8 @@ StatusWith> UserRequestX509::makeUserRequestX509( std::shared_ptr peerInfo, bool forReacquire, bool insertAuthenticatedMechanism) { - auto request = - std::make_unique(std::move(name), std::move(roles), std::move(peerInfo)); + auto request = std::make_unique( + Passkey{}, std::move(name), std::move(roles), std::move(peerInfo)); if (!forReacquire) { return std::unique_ptr(std::move(request)); diff --git a/src/mongo/db/auth/user_request_x509.h b/src/mongo/db/auth/user_request_x509.h index 430cccbd0fb..d49787d0bb2 100644 --- a/src/mongo/db/auth/user_request_x509.h +++ b/src/mongo/db/auth/user_request_x509.h @@ -51,14 +51,12 @@ namespace mongo { * SSLPeerInfo struct if they exist. */ class UserRequestX509 : public UserRequestGeneral { -public: - // We define this function as a friend so that makeUserRequestX509 - // can use it. - friend std::unique_ptr std::make_unique( - mongo::UserName&& name, - boost::optional>&& roles, - std::shared_ptr&& peerInfo); +private: + struct Passkey { + Passkey() = default; + }; +public: /** * Makes a new UserRequestX509. Toggling for re-acquire to true enables * a re-fetch of the roles from the certificate. @@ -90,8 +88,8 @@ public: UserRequestCacheKey generateUserRequestCacheKey() const final; -protected: - UserRequestX509(UserName name, + UserRequestX509(Passkey, + UserName name, boost::optional> roles, std::shared_ptr peerInfo) : UserRequestGeneral(std::move(name), std::move(roles)), _peerInfo(std::move(peerInfo)) {}