mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
serialize no_password
This commit is contained in:
parent
907a54e9f6
commit
57afc5f035
@ -356,7 +356,8 @@ std::shared_ptr<ASTAuthenticationData> AuthenticationData::toAST() const
|
||||
break;
|
||||
}
|
||||
|
||||
case AuthenticationType::NO_PASSWORD: [[fallthrough]];
|
||||
case AuthenticationType::NO_PASSWORD:
|
||||
break;
|
||||
case AuthenticationType::MAX:
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "AST: Unexpected authentication type {}", toString(auth_type));
|
||||
}
|
||||
|
@ -66,10 +66,7 @@ namespace
|
||||
|
||||
for (const auto & authentication_method : user.authentication_methods)
|
||||
{
|
||||
if (authentication_method.getType() != AuthenticationType::NO_PASSWORD)
|
||||
{
|
||||
query->auth_data.push_back(authentication_method.toAST());
|
||||
}
|
||||
query->auth_data.push_back(authentication_method.toAST());
|
||||
}
|
||||
|
||||
if (user.valid_until)
|
||||
|
@ -44,7 +44,7 @@ void ASTAuthenticationData::formatImpl(const FormatSettings & settings, FormatSt
|
||||
{
|
||||
if (type && *type == AuthenticationType::NO_PASSWORD)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << " NOT IDENTIFIED"
|
||||
settings.ostr << (settings.hilite ? IAST::hilite_keyword : "") << " IDENTIFIED WITH no_password"
|
||||
<< (settings.hilite ? IAST::hilite_none : "");
|
||||
return;
|
||||
}
|
||||
|
@ -189,8 +189,15 @@ ASTPtr ASTCreateUserQuery::clone() const
|
||||
if (settings)
|
||||
res->settings = std::static_pointer_cast<ASTSettingsProfileElements>(settings->clone());
|
||||
|
||||
// this is weird.
|
||||
if (!auth_data.empty())
|
||||
if (auth_data.empty())
|
||||
{
|
||||
auto ast = std::make_shared<ASTAuthenticationData>();
|
||||
ast->type = AuthenticationType::NO_PASSWORD;
|
||||
|
||||
res->auth_data.push_back(ast);
|
||||
res->children.push_back(ast);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto & authentication_method : auth_data)
|
||||
{
|
||||
|
@ -284,6 +284,14 @@ INSTANTIATE_TEST_SUITE_P(ParserCreateUserQuery, ParserTest,
|
||||
"CREATE USER user1 IDENTIFIED WITH sha256_password BY 'qwe123'",
|
||||
"CREATE USER user1 IDENTIFIED WITH sha256_password BY 'qwe123'"
|
||||
},
|
||||
{
|
||||
"CREATE USER user1 IDENTIFIED WITH no_password",
|
||||
"CREATE USER user1 IDENTIFIED WITH no_password"
|
||||
},
|
||||
{
|
||||
"CREATE USER user1",
|
||||
"CREATE USER user1 IDENTIFIED WITH no_password"
|
||||
},
|
||||
{
|
||||
"CREATE USER user1 IDENTIFIED WITH plaintext_password BY 'abc123' ADD IDENTIFIED WITH plaintext_password BY 'def123' ADD IDENTIFIED WITH sha256_password BY 'ghi123'",
|
||||
"CREATE USER user1 IDENTIFIED WITH plaintext_password BY 'abc123' ADD IDENTIFIED WITH plaintext_password BY 'def123' ADD IDENTIFIED WITH sha256_password BY 'ghi123'"
|
||||
|
Loading…
Reference in New Issue
Block a user