According to the docs wildcard characters we use for topics throughout the mqtt protocol like +
or #
are treated as literals in policies. The docs recomend using *
as a wildcard character instead but do not describe its effects.
For example will the topic filter :topicfilter:/foo/bar/*
match topic foo/bar/baz/gaz
or only foo/bar/baz
?
Specifically I am trying to allow access to any topic which begins with the thing name of the policy holder. So I would like to allow access to any topic beginning with ${thingName}/
and having any number of forward slashes and url parameters following a matching thingName
. Would topicfilter:${thingName}/*
work or would that only work for topics with one url parameter after thingName
?
Turns out the wildcard *
is a catch all i.e. it will match unlimited trailing url parameters. An important thing to keep in mind is that topicfilter
and topic
are different and are different resources for different MQTT actions as outlined here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With