#3633: Redis: Support Authentication

This commit is contained in:
Günter Obiltschnig 2022-07-03 16:09:49 +02:00
parent 9bde3bc634
commit 13b5605260
2 changed files with 24 additions and 0 deletions

View File

@ -270,6 +270,12 @@ public:
static Command discard();
/// Creates and returns a DISCARD command.
static Command auth(const std::string& password);
/// Creates and returns an AUTH command with the given password.
static Command auth(const std::string& username, const std::string& password);
/// Creates and returns an AUTH command with the given password.
};

View File

@ -735,4 +735,22 @@ Command Command::discard()
}
Command Command::auth(const std::string& password)
{
Command cmd("AUTH");
cmd << password;
return cmd;
}
Command Command::auth(const std::string& username, const std::string& password)
{
Command cmd("AUTH");
cmd << username << password;
return cmd;
}
} } // namespace Poco::Redis