cinfo-authn.conf 1.1 KB

123456789101112131415161718192021222324252627282930
  1. authentication = [
  2. {
  3. mechanism = cinfo
  4. checks = [
  5. # allow clients with username starts with 'super-'
  6. {
  7. is_match = "regex_match(username, '^super-')"
  8. result = allow
  9. },
  10. # deny clients with empty username and client ID starts with 'v1-'
  11. {
  12. # when is_match is an array, it yields 'true' if all individual checks yield 'true'
  13. is_match = ["is_empty_val(username)", "str_eq(nth(1,tokens(clientid,'-')), 'v1')"]
  14. result = deny
  15. }
  16. # if all checks are exhausted without an 'allow' or a 'deny' result, continue to the next authentication
  17. ]
  18. },
  19. # ... more authentications ...
  20. # ...
  21. # if all authenticators are exhausted without an 'allow' or a 'deny' result, the client is not rejected
  22. ]
  23. # A few more match condition examples:
  24. #
  25. # TLS certificate common name is the same as username:
  26. # str_eq(cert_common_name, username)
  27. #
  28. # Password is the 'sha1' hash of environment variable 'EMQXVAR_SECRET' concatenated to client ID:
  29. # str_eq(password, hash('sha1', concat([clientid, getenv('SECRET')])))