Search code examples
autobahnwamp-protocolcrossbarautobahnws

Crossbar.io - Restrict user to subscribe to only two topics


I had seen in the Crossbar.io documentation, that we can set role to publish only to specific topic. But how can I set a role to publish exactly matching two topics rather than pattern based matching.


Solution

  • You can use a configuration like this (see Static Authorization in the docs):

    "realms": [
       {
          "name": "realm1",
          "roles": [
             {
                "name": "role1",
                "permissions": [
                   {
                      "uri": "com.example.topic1",
                      "publish": true
                   },
                   {
                      "uri": "com.example.topic2",
                      "publish": true
                   }
                ]
             }
          ]
       }
    ]