Fixed the configuration of acl_file path
This commit is contained in:
@@ -206,9 +206,11 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
||||
String aclFilePath = props.getProperty(ACL_FILE_PROPERTY_NAME, "");
|
||||
IAuthorizator authorizator;
|
||||
if (aclFilePath != null && !aclFilePath.isEmpty()) {
|
||||
authorizator = new ACLAuthorizator(aclFilePath);
|
||||
authorizator = new ACLAuthorizator(configPath, aclFilePath);
|
||||
LOG.info("Using acl file defined at path {}", aclFilePath);
|
||||
} else {
|
||||
authorizator = new PermitAllAuthorizator();
|
||||
LOG.info("Starting without ACL definition");
|
||||
}
|
||||
|
||||
boolean allowAnonymous = Boolean.parseBoolean(props.getProperty(ALLOW_ANONYMOUS_PROPERTY_NAME, "true"));
|
||||
|
||||
@@ -35,8 +35,8 @@ public class ACLAuthorizator implements IAuthorizator {
|
||||
|
||||
List<Authorization> m_authorisations = Collections.emptyList();
|
||||
|
||||
public ACLAuthorizator(String aclFilePath) {
|
||||
File aclFile = new File(aclFilePath);
|
||||
public ACLAuthorizator(String parent, String filePath) {
|
||||
File aclFile = new File(parent, filePath);
|
||||
try {
|
||||
m_authorisations = ACLFileParser.parse(aclFile);
|
||||
} catch (ParseException pex) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
topic write /sensors/anemometer
|
||||
@@ -13,6 +13,7 @@ host 0.0.0.0
|
||||
|
||||
#Password file
|
||||
password_file config/password_file.conf
|
||||
acl_file config/acl.conf
|
||||
|
||||
#false to accept only client connetions with credentials
|
||||
#true to accept client connection without credentails, validating only the one that provides
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.fusesource.mqtt.client.Topic
|
||||
|
||||
|
||||
String host = args[0]
|
||||
String topic = "/topic"
|
||||
if (args.length > 1) {
|
||||
topic = args[1]
|
||||
}
|
||||
//start a publisher
|
||||
MQTT mqtt2 = new MQTT()
|
||||
mqtt2.setHost(host, 1883)
|
||||
@@ -15,7 +19,7 @@ BlockingConnection publisher = mqtt2.blockingConnection()
|
||||
publisher.connect()
|
||||
println "publisher connected"
|
||||
|
||||
publisher.publish("/topic", 'Hello world again!!'.bytes, QoS.AT_MOST_ONCE, false)
|
||||
publisher.publish(topic, 'Hello world again!!'.bytes, QoS.AT_MOST_ONCE, false)
|
||||
println "publisher published"
|
||||
|
||||
println "shutdown publisher"
|
||||
|
||||
Reference in New Issue
Block a user