Fixed bug once the moquette.conf provided doesn't provide a valid path to pasword.conf

This commit is contained in:
selva.andre
2014-08-23 12:34:31 +02:00
parent 0593b19d51
commit 2be0fd84fe
3 changed files with 23 additions and 2 deletions
+4
View File
@@ -1,3 +1,7 @@
Version 0.7:
Fix issue #38, added aligned to MQTT 3.1.1
Refactored big event switch to @Annotation dispatcher
Version 0.6:
Fix issue #42, bad password file path composition
Fix issue #43, missed topic case (finance/+ does has to match finance)
@@ -0,0 +1,12 @@
package org.dna.mqtt.moquette.messaging.spi.impl;
import org.dna.mqtt.moquette.server.IAuthenticator;
/**
* Created by andrea on 8/23/14.
*/
class AcceptAllAuthenticator implements IAuthenticator {
public boolean checkValid(String username, String password) {
return true;
}
}
@@ -163,9 +163,14 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
List<Subscription> storedSubscriptions = m_sessionsStore.listAllSubscriptions();
subscriptions.init(storedSubscriptions);
String passwdPath = props.getProperty("password_file");
String passwdPath = props.getProperty("password_file", "");
String configPath = System.getProperty("moquette.path", null);
IAuthenticator authenticator = new FileAuthenticator(configPath, passwdPath);
IAuthenticator authenticator;
if (passwdPath.isEmpty()) {
authenticator = new AcceptAllAuthenticator();
} else {
authenticator = new FileAuthenticator(configPath, passwdPath);
}
m_processor.init(subscriptions, m_storageService, m_sessionsStore, authenticator);
}