Merge pull request #7901 from zmstone/0508-docs-authn-refine-config-doc
docs(authn): use hocon enum for use_id_type
This commit is contained in:
commit
5bd1ae6bed
|
@ -1,20 +1,20 @@
|
||||||
emqx_authn_mnesia {
|
emqx_authn_mnesia {
|
||||||
authentication {
|
authentication {
|
||||||
desc {
|
desc {
|
||||||
en: """Configuration of authenticator using built-in database as authentication data source."""
|
en: """Configuration of authenticator using built-in database as data source."""
|
||||||
zh: """使用内置数据库作为认证数据源的认证器的配置项。"""
|
zh: """使用内置数据库作为认证数据源的认证器的配置项。"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user_id_type {
|
user_id_type {
|
||||||
desc {
|
desc {
|
||||||
en: """Specify whether to use ClientID or Username as User ID for authentication."""
|
en: """Specify whether to use `clientid` or `username` for authentication."""
|
||||||
zh: """指定使用 ClientID 还是 Username 作为 User ID 进行认证。"""
|
zh: """指定使用客户端ID `clientid` 还是用户名 `username` 进行认证。"""
|
||||||
}
|
}
|
||||||
|
|
||||||
label: {
|
label: {
|
||||||
en: """User ID Type"""
|
en: """Authentication ID Type"""
|
||||||
zh: """用户 ID 类型"""
|
zh: """认证 ID 类型"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
group_match_spec/1
|
group_match_spec/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-type user_id_type() :: clientid | username.
|
|
||||||
-type user_group() :: binary().
|
-type user_group() :: binary().
|
||||||
-type user_id() :: binary().
|
-type user_id() :: binary().
|
||||||
|
|
||||||
|
@ -64,8 +63,6 @@
|
||||||
is_superuser :: boolean()
|
is_superuser :: boolean()
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-reflect_type([user_id_type/0]).
|
|
||||||
|
|
||||||
-export([mnesia/1]).
|
-export([mnesia/1]).
|
||||||
|
|
||||||
-boot_mnesia({mnesia, [boot]}).
|
-boot_mnesia({mnesia, [boot]}).
|
||||||
|
@ -115,7 +112,7 @@ desc(?CONF_NS) ->
|
||||||
desc(_) ->
|
desc(_) ->
|
||||||
undefined.
|
undefined.
|
||||||
|
|
||||||
user_id_type(type) -> user_id_type();
|
user_id_type(type) -> hoconsc:enum([clientid, username]);
|
||||||
user_id_type(desc) -> ?DESC(?FUNCTION_NAME);
|
user_id_type(desc) -> ?DESC(?FUNCTION_NAME);
|
||||||
user_id_type(default) -> <<"username">>;
|
user_id_type(default) -> <<"username">>;
|
||||||
user_id_type(required) -> true;
|
user_id_type(required) -> true;
|
||||||
|
|
|
@ -580,9 +580,6 @@ hocon_schema_to_spec(?UNION(Types), LocalModule) ->
|
||||||
hocon_schema_to_spec(Atom, _LocalModule) when is_atom(Atom) ->
|
hocon_schema_to_spec(Atom, _LocalModule) when is_atom(Atom) ->
|
||||||
{#{type => string, enum => [Atom]}, []}.
|
{#{type => string, enum => [Atom]}, []}.
|
||||||
|
|
||||||
%% todo: Find a way to fetch enum value from user_id_type().
|
|
||||||
typename_to_spec("user_id_type()", _Mod) ->
|
|
||||||
#{type => string, enum => [clientid, username]};
|
|
||||||
typename_to_spec("term()", _Mod) ->
|
typename_to_spec("term()", _Mod) ->
|
||||||
#{type => string, example => <<"any">>};
|
#{type => string, example => <<"any">>};
|
||||||
typename_to_spec("boolean()", _Mod) ->
|
typename_to_spec("boolean()", _Mod) ->
|
||||||
|
|
Loading…
Reference in New Issue