fix(emqx_authn): fix create api
This commit is contained in:
parent
d8819559f7
commit
580901b678
|
@ -35,3 +35,5 @@
|
|||
-define(CONF_NS_BINARY, ?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY).
|
||||
|
||||
-endif.
|
||||
|
||||
-define(RESOURCE_GROUP, <<"emqx_authn">>).
|
|
@ -17,6 +17,7 @@
|
|||
-module(emqx_authn_utils).
|
||||
|
||||
-include_lib("emqx/include/emqx_placeholder.hrl").
|
||||
-include_lib("emqx_authn.hrl").
|
||||
|
||||
-export([ check_password_from_selected_map/3
|
||||
, parse_deep/1
|
||||
|
@ -32,8 +33,6 @@
|
|||
, make_resource_id/1
|
||||
]).
|
||||
|
||||
-define(RESOURCE_GROUP, <<"emqx_authn">>).
|
||||
|
||||
-define(AUTHN_PLACEHOLDERS, [?PH_USERNAME,
|
||||
?PH_CLIENTID,
|
||||
?PH_PASSWORD,
|
||||
|
@ -120,7 +119,7 @@ cleanup_resources() ->
|
|||
|
||||
make_resource_id(Name) ->
|
||||
NameBin = bin(Name),
|
||||
emqx_resource:generate_id(?RESOURCE_GROUP, NameBin).
|
||||
emqx_resource:generate_id(NameBin).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% Internal functions
|
||||
|
|
|
@ -134,6 +134,7 @@ create(#{method := Method,
|
|||
request_timeout => RequestTimeout,
|
||||
resource_id => ResourceId},
|
||||
case emqx_resource:create_local(ResourceId,
|
||||
?RESOURCE_GROUP,
|
||||
emqx_connector_http,
|
||||
Config#{base_url => maps:remove(query, URIMap),
|
||||
pool_type => random}) of
|
||||
|
|
|
@ -112,7 +112,7 @@ create(#{selector := Selector} = Config) ->
|
|||
NState = State#{
|
||||
selector_template => SelectorTemplate,
|
||||
resource_id => ResourceId},
|
||||
case emqx_resource:create_local(ResourceId, emqx_connector_mongo, Config) of
|
||||
case emqx_resource:create_local(ResourceId, ?RESOURCE_GROUP, emqx_connector_mongo, Config) of
|
||||
{ok, already_created} ->
|
||||
{ok, NState};
|
||||
{ok, _} ->
|
||||
|
|
|
@ -82,7 +82,7 @@ create(#{password_hash_algorithm := Algorithm,
|
|||
placeholders => PlaceHolders,
|
||||
query_timeout => QueryTimeout,
|
||||
resource_id => ResourceId},
|
||||
case emqx_resource:create_local(ResourceId, emqx_connector_mysql, Config) of
|
||||
case emqx_resource:create_local(ResourceId, ?RESOURCE_GROUP, emqx_connector_mysql, Config) of
|
||||
{ok, already_created} ->
|
||||
{ok, State};
|
||||
{ok, _} ->
|
||||
|
|
|
@ -79,7 +79,7 @@ create(#{query := Query0,
|
|||
State = #{placeholders => PlaceHolders,
|
||||
password_hash_algorithm => Algorithm,
|
||||
resource_id => ResourceId},
|
||||
case emqx_resource:create_local(ResourceId, emqx_connector_pgsql, Config#{named_queries => #{ResourceId => Query}}) of
|
||||
case emqx_resource:create_local(ResourceId, ?RESOURCE_GROUP, emqx_connector_pgsql, Config#{named_queries => #{ResourceId => Query}}) of
|
||||
{ok, already_created} ->
|
||||
{ok, State};
|
||||
{ok, _} ->
|
||||
|
|
|
@ -91,7 +91,7 @@ create(#{cmd := Cmd,
|
|||
NState = State#{
|
||||
cmd => NCmd,
|
||||
resource_id => ResourceId},
|
||||
case emqx_resource:create_local(ResourceId, emqx_connector_redis, Config) of
|
||||
case emqx_resource:create_local(ResourceId, ?RESOURCE_GROUP, emqx_connector_redis, Config) of
|
||||
{ok, already_created} ->
|
||||
{ok, NState};
|
||||
{ok, _} ->
|
||||
|
|
Loading…
Reference in New Issue