blob: de166bdf234a0f020a611d232f01fd2c5ece47a0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#pragma once
#include <Parsers/IAST.h>
#include <Access/Common/AuthenticationType.h>
#include <optional>
namespace DB
{
/** Represents authentication data in CREATE/ALTER USER query:
* ... IDENTIFIED WITH sha256_password BY 'password'
*
* Can store password, hash and salt, LDAP server name, Kerberos Realm, or common names.
* They are stored in children vector as ASTLiteral or ASTQueryParameter.
* ASTAuthenticationData without a type represents authentication data with
* the default password type that will be later inferred from the server parameters.
*/
class ASTAuthenticationData : public IAST
{
public:
String getID(char) const override { return "AuthenticationData"; }
ASTPtr clone() const override
{
auto clone = std::make_shared<ASTAuthenticationData>(*this);
clone->cloneChildren();
return clone;
}
bool hasSecretParts() const override;
std::optional<String> getPassword() const;
std::optional<String> getSalt() const;
/// If type is empty we use the default password type.
/// AuthenticationType::NO_PASSWORD is specified explicitly.
std::optional<AuthenticationType> type;
bool contains_password = false;
bool contains_hash = false;
protected:
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
};
}
|