fix(schema): fix config schema for authn
This commit is contained in:
parent
cafed47da6
commit
a5a596e3ac
|
@ -80,7 +80,7 @@ server_type(type) -> hoconsc:enum(['built-in-database']);
|
||||||
server_type(default) -> 'built-in-database';
|
server_type(default) -> 'built-in-database';
|
||||||
server_type(_) -> undefined.
|
server_type(_) -> undefined.
|
||||||
|
|
||||||
algorithm(type) -> hoconsc:enum([sha256, sha256]);
|
algorithm(type) -> hoconsc:enum([sha256, sha512]);
|
||||||
algorithm(default) -> sha256;
|
algorithm(default) -> sha256;
|
||||||
algorithm(_) -> undefined.
|
algorithm(_) -> undefined.
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,29 @@ structs() -> [config].
|
||||||
fields(config) ->
|
fields(config) ->
|
||||||
[ {server_type, {enum, [mysql]}}
|
[ {server_type, {enum, [mysql]}}
|
||||||
, {password_hash_algorithm, fun password_hash_algorithm/1}
|
, {password_hash_algorithm, fun password_hash_algorithm/1}
|
||||||
, {salt_position, {enum, [prefix, suffix]}}
|
, {salt_position, fun salt_position/1}
|
||||||
, {query, fun query/1}
|
, {query, fun query/1}
|
||||||
, {query_timeout, fun query_timeout/1}
|
, {query_timeout, fun query_timeout/1}
|
||||||
] ++ emqx_connector_schema_lib:relational_db_fields()
|
] ++ emqx_connector_schema_lib:relational_db_fields()
|
||||||
++ emqx_connector_schema_lib:ssl_fields().
|
++ emqx_connector_schema_lib:ssl_fields();
|
||||||
|
|
||||||
password_hash_algorithm(type) -> string();
|
fields(bcrypt) ->
|
||||||
|
[ {name, {enum, [bcrypt]}}
|
||||||
|
, {salt_rounds, fun salt_rounds/1}
|
||||||
|
];
|
||||||
|
|
||||||
|
fields(other_algorithms) ->
|
||||||
|
[ {name, {enum, [plain, md5, sha, sha256, sha512]}}
|
||||||
|
].
|
||||||
|
|
||||||
|
password_hash_algorithm(type) -> {union, [hoconsc:ref(bcrypt), hoconsc:ref(other_algorithms)]};
|
||||||
|
password_hash_algorithm(default) -> #{<<"name">> => sha256};
|
||||||
password_hash_algorithm(_) -> undefined.
|
password_hash_algorithm(_) -> undefined.
|
||||||
|
|
||||||
|
salt_position(type) -> {enum, [prefix, suffix]};
|
||||||
|
salt_position(default) -> prefix;
|
||||||
|
salt_position(_) -> undefined.
|
||||||
|
|
||||||
query(type) -> string();
|
query(type) -> string();
|
||||||
query(nullable) -> false;
|
query(nullable) -> false;
|
||||||
query(_) -> undefined.
|
query(_) -> undefined.
|
||||||
|
|
Loading…
Reference in New Issue