feat(special_authn): set hook priority
This commit is contained in:
parent
f0a5208f3c
commit
b71b106456
|
@ -105,13 +105,22 @@ set_special_auth_module() ->
|
|||
Mod ->
|
||||
case erlang:function_exported(Mod, check_authn, 2) of
|
||||
true ->
|
||||
Priority = authn_module_priority(Mod),
|
||||
persistent_term:put(special_auth_module, Mod),
|
||||
emqx:hook('client.authenticate', fun Mod:check_authn/2, []);
|
||||
emqx:hook('client.authenticate', fun Mod:check_authn/2, Priority);
|
||||
false ->
|
||||
ok
|
||||
end
|
||||
end.
|
||||
|
||||
authn_module_priority(Mod) ->
|
||||
try
|
||||
Mod:authn_priority()
|
||||
catch
|
||||
_:_ ->
|
||||
10_000
|
||||
end.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Print Banner
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue