activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aliquip <aliq...@gmail.com>
Subject Re: ActiveMQ (5.7 snaphot) BrokerFilter (when using MQTT) addProducer prodocuerInfo destination is null
Date Tue, 25 Sep 2012 21:02:40 GMT
Got it working by overriding message send (As the Stomp protocol had similar
behaviour i guess the behaviour mentioned above is intentional):

===========================================================================
class UpoAuthenticationBroker(next: Broker, admin_user: String, admin_pw:
String) extends BrokerFilter(next) {
override def send(exchange: ProducerBrokerExchange, message: Message) = {
    val sc =
exchange.getConnectionContext().getSecurityContext().asInstanceOf[UpoSecurityContext]
    if (sc.canWrite(message.getDestination())) {
      println("User  " + sc.user + "  _is_ authorized to write to: " +
message.getDestination())
      super.send(exchange, message)
    } else {
      throw new SecurityException("User  " + sc.user + "  is not authorized
to write to: " + message.getDestination())
    }

  }
}
===========================================================================

Sadly, not much joy using mqtt yet, now my client gets disconnected wile it
happily pings the broker :/ But thats out of scope for this problem i think



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-5-7-snaphot-BrokerFilter-when-using-MQTT-addProducer-prodocuerInfo-destination-is-null-tp4656950p4656971.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message