It seems like the Mosquitto broker does not allow this:
https://github.com/eclipse/mosquitto/issues/1839#issuecomment-707656348
So the next best option will be to run two listeners on the same broker. Each listener having its own authentication configuration. I still need to verify that my message handler can subscribe to messages published from both types of devices. But I guess this should work since it is on the same broker.
Here is my working configuration:
# SSL/TLS with certificate authentication
listener port
use_identity_as_username true
require_certificate true
cafile pathtocafile
certfile pathtocertfile
keyfile pathtokeyfile
# Username and Password authentication
listener port
per_listener_settings true
password_file pathtopasswordfile
[Updated on: Sat, 24 June 2023 12:03] by Moderator