broker/QosPublishHandler: code formatter used

This commit is contained in:
Andreas Mager
2017-02-01 17:13:40 +01:00
parent 127894b2f9
commit 609cd5c8f8
@@ -1,30 +1,32 @@
package io.moquette.spi.impl; package io.moquette.spi.impl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import io.moquette.server.netty.NettyUtils; import io.moquette.server.netty.NettyUtils;
import io.moquette.spi.security.IAuthorizator; import io.moquette.spi.security.IAuthorizator;
import io.netty.channel.Channel; import io.netty.channel.Channel;
abstract class QosPublishHandler { abstract class QosPublishHandler {
private static final Logger LOG = LoggerFactory.getLogger(QosPublishHandler.class); private static final Logger LOG = LoggerFactory.getLogger(QosPublishHandler.class);
private final IAuthorizator m_authorizator; private final IAuthorizator m_authorizator;
protected QosPublishHandler(IAuthorizator m_authorizator) { protected QosPublishHandler(IAuthorizator m_authorizator) {
this.m_authorizator = m_authorizator; this.m_authorizator = m_authorizator;
} }
public boolean checkWriteOnTopic(String topic, Channel channel) { public boolean checkWriteOnTopic(String topic, Channel channel) {
String clientID = NettyUtils.clientID(channel); String clientID = NettyUtils.clientID(channel);
String username = NettyUtils.userName(channel); String username = NettyUtils.userName(channel);
if (!m_authorizator.canWrite(topic, username, clientID)) { if (!m_authorizator.canWrite(topic, username, clientID)) {
LOG.error("The MQTT client is not authorized to publish on topic. MqttClientId = {}, topic = {}.", clientID, LOG.error(
topic); "The MQTT client is not authorized to publish on topic. MqttClientId = {}, topic = {}.",
return true; clientID,
} topic);
return false; return true;
} }
return false;
}
} }