#pragma once #include #include #include namespace DB { namespace ErrorCodes { extern const int BAD_ARGUMENTS; } class Credentials; class ExternalAuthenticators; /// TODO: Try to move this checking to Credentials. struct Authentication { /// Checks the credentials (passwords, readiness, etc.) static bool areCredentialsValid(const Credentials & credentials, const AuthenticationData & auth_data, const ExternalAuthenticators & external_authenticators); // A signaling class used to communicate requirements for credentials. template class Require : public Exception { public: explicit Require(const String & realm_); const String & getRealm() const; private: const String realm; }; }; template Authentication::Require::Require(const String & realm_) : Exception("Credentials required", ErrorCodes::BAD_ARGUMENTS) , realm(realm_) { } template const String & Authentication::Require::getRealm() const { return realm; } }