emqx_authn_chains.hrl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2021-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -ifndef(EMQX_AUTHN_CHAINS_HRL).
  17. -define(EMQX_AUTHN_CHAINS_HRL, true).
  18. -include_lib("emqx/include/logger.hrl").
  19. -include_lib("emqx/include/emqx_access_control.hrl").
  20. -define(GLOBAL, 'mqtt:global').
  21. -define(TRACE_AUTHN_PROVIDER(Msg), ?TRACE_AUTHN_PROVIDER(Msg, #{})).
  22. -define(TRACE_AUTHN_PROVIDER(Msg, Meta), ?TRACE_AUTHN_PROVIDER(debug, Msg, Meta)).
  23. -define(TRACE_AUTHN_PROVIDER(Level, Msg, Meta),
  24. ?TRACE_AUTHN(Level, Msg, (Meta)#{provider => ?MODULE})
  25. ).
  26. -define(TRACE_AUTHN(Msg, Meta), ?TRACE_AUTHN(debug, Msg, Meta)).
  27. -define(TRACE_AUTHN(Level, Msg, Meta), ?TRACE(Level, ?AUTHN_TRACE_TAG, Msg, Meta)).
  28. %% config root name all auth providers have to agree on.
  29. -define(EMQX_AUTHENTICATION_CONFIG_ROOT_NAME, "authentication").
  30. -define(EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_ATOM, authentication).
  31. -define(EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY, <<"authentication">>).
  32. %% authentication move cmd
  33. -define(CMD_MOVE_FRONT, front).
  34. -define(CMD_MOVE_REAR, rear).
  35. -define(CMD_MOVE_BEFORE(Before), {before, Before}).
  36. -define(CMD_MOVE_AFTER(After), {'after', After}).
  37. -define(CMD_MERGE, merge).
  38. -endif.