This commit is contained in:
+2
-2
@@ -57,7 +57,7 @@ public class InterceptConnectMessage extends InterceptAbstractMessage {
|
||||
return msg.getUsername();
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
public byte[] getPassword() {
|
||||
return msg.getPassword();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class InterceptConnectMessage extends InterceptAbstractMessage {
|
||||
return msg.getWillTopic();
|
||||
}
|
||||
|
||||
public String getWillMessage() {
|
||||
public byte[] getWillMessage() {
|
||||
return msg.getWillMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
||||
|
||||
//handle user authentication
|
||||
if (msg.isUserFlag()) {
|
||||
String pwd = null;
|
||||
byte[] pwd = null;
|
||||
if (msg.isPasswordFlag()) {
|
||||
pwd = msg.getPassword();
|
||||
} else if (!this.allowAnonymous) {
|
||||
@@ -225,7 +225,7 @@ class ProtocolProcessor implements EventHandler<ValueEvent> {
|
||||
//Handle will flag
|
||||
if (msg.isWillFlag()) {
|
||||
AbstractMessage.QOSType willQos = AbstractMessage.QOSType.values()[msg.getWillQos()];
|
||||
byte[] willPayload = msg.getWillMessage().getBytes();
|
||||
byte[] willPayload = msg.getWillMessage();
|
||||
ByteBuffer bb = (ByteBuffer) ByteBuffer.allocate(willPayload.length).put(willPayload).flip();
|
||||
//save the will testament in the clientID store
|
||||
WillMessage will = new WillMessage(msg.getWillTopic(), bb, msg.isWillRetain(),willQos );
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ package org.eclipse.moquette.spi.impl.security;
|
||||
* Created by andrea on 8/23/14.
|
||||
*/
|
||||
public class AcceptAllAuthenticator implements IAuthenticator {
|
||||
public boolean checkValid(String username, String password) {
|
||||
public boolean checkValid(String username, byte[] password) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class FileAuthenticator implements IAuthenticator {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkValid(String username, String password) {
|
||||
public boolean checkValid(String username, byte[] password) {
|
||||
if (username == null || password == null) {
|
||||
LOG.info("username or password was null");
|
||||
return false;
|
||||
@@ -115,11 +115,7 @@ public class FileAuthenticator implements IAuthenticator {
|
||||
if (foundPwq == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
m_digest.update(password.getBytes("UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
m_digest.update(password);
|
||||
byte[] digest = m_digest.digest();
|
||||
String encodedPasswd = new String(Hex.encodeHex(digest));
|
||||
return foundPwq.equals(encodedPasswd);
|
||||
|
||||
@@ -22,5 +22,5 @@ package org.eclipse.moquette.spi.impl.security;
|
||||
*/
|
||||
public interface IAuthenticator {
|
||||
|
||||
boolean checkValid(String username, String password);
|
||||
boolean checkValid(String username, byte[] password);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user