Java Mqtt with Authorization with RabbitMq

76 views
Skip to first unread message

Lotiya Hardik

unread,
Dec 9, 2016, 7:49:13 AM12/9/16
to rabbitmq-users
Hello,

I'm using mqtt client3.6 with Rabbitmq

I have added vhost and user using rabbitmqctl command

and also set permission added some conf it like

rabbitmqctl add_vhost hardikHost
rabbitmqctl add_user nirav nirav
rabbitmqctl set_permissions -p hardikHost nirav "nirav.*" ".*" ".*"

 now i'm going to connect with server its snipped code is

 String broker = "tcp://localhost:1883";
        //String broker = "ssl://localhost:8883";
        String clientId = "Publisher";
        MemoryPersistence persistence = new MemoryPersistence();

        MqttConnectOptions connOpts = new MqttConnectOptions();
        connOpts.setUserName("hardikHost:nirav");
        connOpts.setPassword("nirav".toCharArray());
        connOpts.setCleanSession(true);
       
      
        MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
        sampleClient.connect(connOpts);
       
        System.out.println("connected");
        MqttMessage message=new MqttMessage("HELLO".getBytes());
        message.setQos(1);
        sampleClient.publish(TOPIC, message);
       
       
        System.out.println("published");



here this code is working fine, but in this topic is different as compare to user permissions.

any thing wrong in above code?



Michael Klishin

unread,
Dec 9, 2016, 7:55:58 AM12/9/16
to rabbitm...@googlegroups.com
`rabbitmqctl set_permissions` operates in terms of the first protocol implemented by RabbitMQ: AMQP 0-9-1 [1].
Topics (routing keys) are not currently first class resources when it comes to authorization [2].

Authorization backends are pluggable [3] and by combining [4] and [5] some users get around this. [6] can be
combined with [5] to reduce authz backend load.


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages