summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/authentication_commands.h
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2018-04-26 13:12:35 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2018-04-27 11:22:20 -0400
commitac1e34979ac20b9bb722449ed888a679a62b1252 (patch)
treef2b21aca43429af00433695f636c1e21f69c3eaa /src/mongo/db/commands/authentication_commands.h
parent580d395d40e935adb8453ba7420cdc28e6f601a1 (diff)
downloadmongo-ac1e34979ac20b9bb722449ed888a679a62b1252.tar.gz
SERVER-34698 cleanup physical structure of CmdAuthenticate
Diffstat (limited to 'src/mongo/db/commands/authentication_commands.h')
-rw-r--r--src/mongo/db/commands/authentication_commands.h52
1 files changed, 4 insertions, 48 deletions
diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h
index c2c74665eeb..bbac9e94d50 100644
--- a/src/mongo/db/commands/authentication_commands.h
+++ b/src/mongo/db/commands/authentication_commands.h
@@ -28,56 +28,12 @@
#pragma once
-#include <string>
-
-#include "mongo/base/status.h"
-#include "mongo/db/auth/user_name.h"
-#include "mongo/db/commands.h"
+#include "mongo/base/string_data.h"
namespace mongo {
-class CmdAuthenticate : public BasicCommand {
-public:
- static void disableAuthMechanism(std::string authMechanism);
-
- AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- return AllowedOnSecondary::kAlways;
- }
- std::string help() const override {
- return "internal";
- }
- virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
- return false;
- }
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) const {} // No auth required
-
- CmdAuthenticate() : BasicCommand("authenticate") {}
- bool run(OperationContext* opCtx,
- const std::string& dbname,
- const BSONObj& cmdObj,
- BSONObjBuilder& result);
+constexpr StringData kX509AuthMechanism = "MONGODB-X509"_sd;
-private:
- /**
- * Completes the authentication of "user" using "mechanism" and parameters from "cmdObj".
- *
- * Returns Status::OK() on success. All other statuses indicate failed authentication. The
- * entire status returned here may always be used for logging. However, if the code is
- * AuthenticationFailed, the "reason" field of the return status may contain information
- * that should not be revealed to the connected client.
- *
- * Other than AuthenticationFailed, common returns are BadValue, indicating unsupported
- * mechanism, and ProtocolError, indicating an error in the use of the authentication
- * protocol.
- */
- Status _authenticate(OperationContext* opCtx,
- const std::string& mechanism,
- const UserName& user,
- const BSONObj& cmdObj);
- Status _authenticateX509(OperationContext* opCtx, const UserName& user, const BSONObj& cmdObj);
-};
+void disableAuthMechanism(StringData authMechanism);
-extern CmdAuthenticate cmdAuthenticate;
-}
+} // namespace mongo