mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
Add log_and_mask_exceptions flag to login()
This commit is contained in:
parent
1eb8ecf050
commit
2fc6a4ea9c
@ -420,13 +420,17 @@ UUID IAccessStorage::login(
|
|||||||
const String & user_name,
|
const String & user_name,
|
||||||
const String & password,
|
const String & password,
|
||||||
const Poco::Net::IPAddress & address,
|
const Poco::Net::IPAddress & address,
|
||||||
const ExternalAuthenticators & external_authenticators) const
|
const ExternalAuthenticators & external_authenticators,
|
||||||
|
bool log_and_mask_exceptions) const
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return loginImpl(user_name, password, address, external_authenticators);
|
return loginImpl(user_name, password, address, external_authenticators);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
if (!log_and_mask_exceptions)
|
||||||
|
throw;
|
||||||
|
|
||||||
tryLogCurrentException(getLogger(), user_name + ": Authentication failed");
|
tryLogCurrentException(getLogger(), user_name + ": Authentication failed");
|
||||||
throwCannotAuthenticate(user_name);
|
throwCannotAuthenticate(user_name);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
/// Finds an user, check its password and returns the ID of the user.
|
/// Finds an user, check its password and returns the ID of the user.
|
||||||
/// Throws an exception if no such user or password is incorrect.
|
/// Throws an exception if no such user or password is incorrect.
|
||||||
UUID login(const String & user_name, const String & password, const Poco::Net::IPAddress & address, const ExternalAuthenticators & external_authenticators) const;
|
UUID login(const String & user_name, const String & password, const Poco::Net::IPAddress & address, const ExternalAuthenticators & external_authenticators, bool log_and_mask_exceptions = true) const;
|
||||||
|
|
||||||
/// Returns the ID of an user who has logged in (maybe on another node).
|
/// Returns the ID of an user who has logged in (maybe on another node).
|
||||||
/// The function assumes that the password has been already checked somehow, so we can skip checking it now.
|
/// The function assumes that the password has been already checked somehow, so we can skip checking it now.
|
||||||
|
@ -409,7 +409,7 @@ UUID MultipleAccessStorage::loginImpl(const String & user_name, const String & p
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto id = storage->login(user_name, password, address, external_authenticators);
|
auto id = storage->login(user_name, password, address, external_authenticators, false);
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
ids_cache.set(id, storage);
|
ids_cache.set(id, storage);
|
||||||
return id;
|
return id;
|
||||||
|
Loading…
Reference in New Issue
Block a user