Discussion:
[rabbitmq-users] Issue when using rabbitMQ MQTT
shriyansh jain
2015-07-31 11:06:21 UTC
Permalink
Hi,

I am sending data to a particular topic("Test") using user details(UserNAme:*
userA* Password: *UserApwd*) but at then time of receiving I am using
different user credentials (UserNAme:* userB* Password: *UserBpwd*) he is
also receiving the data from topic(* "Test"*).
How i can set the authentication Please let me know.

*Sender Code:*

MqttClient client = new MqttClient("Rabbit MQ VM IP");
client.Connect(*"ClientName1", "userA", "UserApwd"*);
string[] topic = {* "Test"* };
byte[] qoslevels = { MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE };
client.Subscribe(topic, qoslevels);
client.MqttMsgPublished += new
MqttClient.MqttMsgPublishedEventHandler(client_MqttMsgPublished);

for (int i = 0; i < 10; i++)
{
ushort t = client.Publish("/queue/test",
Encoding.UTF8.GetBytes("testmessage" + i),
MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE, true);
Console.WriteLine("Sending: " + "testmessage" + i);
Console.WriteLine();
}

*Receiver Code*

static void Main(string[] args)
{
MqttClient client = new MqttClient("Rabbit MQ VM IP");
client.Connect(*"ClientName2", "userB", "UserBpwd"*);
string[] topic = {* "**Test**"* };
byte[] qoslevels = { MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE };
client.Subscribe(topic, qoslevels);
client.MqttMsgPublishReceived += new
MqttClient.MqttMsgPublishEventHandler(client_PublishArrived);

Console.ReadLine();
}

private static void client_PublishArrived(object sender,
MqttMsgPublishEventArgs e)
{
Console.WriteLine("Message Received " +
Encoding.UTF8.GetString(e.Message));
Console.WriteLine();
}

Thanks
--
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+***@googlegroups.com.
To post to this group, send an email to rabbitmq-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Klishin
2015-07-31 11:12:38 UTC
Permalink
userA Password: UserApwd) but at then time of receiving I am using
different user credentials (UserNAme: userB Password: UserBpwd)
he is also receiving the data from topic( "Test").
How i can set the authentication Please let me know.
Authentication or authorisation? What's your end goal? 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ
--
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+***@googlegroups.com.
To post to this group, send an email to rabbitmq-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
shriyansh jain
2015-07-31 11:19:05 UTC
Permalink
I don't want to receive message of one topic to other user so we need to
implement authorisation here at Topic level. We will authenticate with the
help of username and password.
Post by Michael Klishin
Post by shriyansh jain
I am sending data to a particular topic("Test") using user
userA Password: UserApwd) but at then time of receiving I am using
different user credentials (UserNAme: userB Password: UserBpwd)
he is also receiving the data from topic( "Test").
How i can set the authentication Please let me know.
Authentication or authorisation? What's your end goal?
--
MK
Staff Software Engineer, Pivotal/RabbitMQ
--
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+***@googlegroups.com.
To post to this group, send an email to rabbitmq-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Klishin
2015-07-31 11:34:29 UTC
Permalink
Post by shriyansh jain
I don't want to receive message of one topic to other user so we
need to implement authorisation here at Topic level. We will
authenticate with the help of username and password.
MQTT (the protocol) doesn't have a concept of authorisation
and RabbitMQ's authorisation concepts are originally built for a single
(and fairly different) protocol [1].

RabbitMQ MQTT plugin will have support for it in 3.6.0 [2].
You'll  be able to restrict clients from subscribing to specific topics.

1. http://www.rabbitmq.com/access-control.html
2. https://github.com/rabbitmq/rabbitmq-mqtt/pull/28
--
MK

Staff Software Engineer, Pivotal/RabbitMQ
--
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+***@googlegroups.com.
To post to this group, send an email to rabbitmq-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...